Skip to content
代码片段 群组 项目
未验证 提交 25497359 编辑于 作者: Eduardo Bonet's avatar Eduardo Bonet 提交者: GitLab
浏览文件

Fixes issue with valid Notebooks not diffing

The diffing library was not taking into account that notebook code cells
can have no output entry, and assumed there would be an empty output
entry instead, which was causing errors

Changelog: fixed
上级 5ef431db
No related branches found
No related tags found
无相关合并请求
...@@ -100,7 +100,7 @@ PATH ...@@ -100,7 +100,7 @@ PATH
PATH PATH
remote: gems/ipynbdiff remote: gems/ipynbdiff
specs: specs:
ipynbdiff (0.4.7) ipynbdiff (0.4.8)
diffy (~> 3.4) diffy (~> 3.4)
oj (~> 3.13.16) oj (~> 3.13.16)
......
PATH PATH
remote: . remote: .
specs: specs:
ipynbdiff (0.4.7) ipynbdiff (0.4.8)
diffy (~> 3.4) diffy (~> 3.4)
oj (~> 3.13.16) oj (~> 3.13.16)
......
...@@ -80,6 +80,8 @@ def transform_code_cell(cell, notebook, symbol) ...@@ -80,6 +80,8 @@ def transform_code_cell(cell, notebook, symbol)
end end
def transform_outputs(outputs, symbol) def transform_outputs(outputs, symbol)
return [] unless outputs
transformed = outputs.map transformed = outputs.map
.with_index { |output, i| @out_transformer.transform(output, symbol / ['outputs', i]) } .with_index { |output, i| @out_transformer.transform(output, symbol / ['outputs', i]) }
.compact .compact
......
...@@ -2,6 +2,6 @@ ...@@ -2,6 +2,6 @@
module IpynbDiff module IpynbDiff
module Version module Version
VERSION = '0.4.7' VERSION = '0.4.8'
end end
end end
...@@ -20,6 +20,10 @@ def test_case_input_path(test_case) ...@@ -20,6 +20,10 @@ def test_case_input_path(test_case)
File.join(BASE_PATH, test_case, 'input.ipynb') File.join(BASE_PATH, test_case, 'input.ipynb')
end end
def test_case_input_path_test(test_case)
File.join(BASE_PATH, test_case, 'input.ipynb.test')
end
def test_case_symbols_path(test_case) def test_case_symbols_path(test_case)
File.join(BASE_PATH, test_case, 'expected_symbols.txt') File.join(BASE_PATH, test_case, 'expected_symbols.txt')
end end
...@@ -38,7 +42,8 @@ def read_file_if_exists(path) ...@@ -38,7 +42,8 @@ def read_file_if_exists(path)
def read_test_case(test_case_name) def read_test_case(test_case_name)
{ {
input: read_file_if_exists(test_case_input_path(test_case_name)), input: read_file_if_exists(test_case_input_path(test_case_name)) ||
read_file_if_exists(test_case_input_path_test(test_case_name)),
expected_markdown: read_file_if_exists(test_case_md_path(test_case_name)), expected_markdown: read_file_if_exists(test_case_md_path(test_case_name)),
expected_symbols: read_file_if_exists(test_case_symbols_path(test_case_name)), expected_symbols: read_file_if_exists(test_case_symbols_path(test_case_name)),
expected_line_numbers: read_file_if_exists(test_case_line_numbers_path(test_case_name)) expected_line_numbers: read_file_if_exists(test_case_line_numbers_path(test_case_name))
......
...@@ -5,7 +5,6 @@ ...@@ -5,7 +5,6 @@
"execution_count": 1, "execution_count": 1,
"id": "3", "id": "3",
"metadata": {}, "metadata": {},
"outputs": [],
"source": [ "source": [
"import pandas as pd\n", "import pandas as pd\n",
"import numpy as np\n", "import numpy as np\n",
......
0% 加载中 .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册