Skip to content

Commit 44f770a

Browse files
committed
improve tests
1 parent 7dee920 commit 44f770a

File tree

5 files changed

+15
-10
lines changed

5 files changed

+15
-10
lines changed

tests/data/formatters/HtmlFormatter.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -377,9 +377,6 @@
377377
'sublist_filled_noA': {
378378
'result': '<div class="nDvD"></div>',
379379
},
380-
'text_diff_disabled': {
381-
'result': '<div class="nDvD"><div>- <div class="nDvO">&#x27;A\\nB&#x27;</div></div><div>+ <div class="nDvN">&#x27;B\\nC&#x27;</div></div></div>',
382-
},
383380
'text_equal': {
384381
'result': '<div class="nDvD"></div>',
385382
},

tests/data/formatters/TermFormatter.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -377,9 +377,6 @@
377377
'sublist_filled_noA': {
378378
'result': '',
379379
},
380-
'text_diff_disabled': {
381-
'result': "\x1b[31m- 'A\\nB'\x1b[0m\n\x1b[32m+ 'B\\nC'\x1b[0m\n",
382-
},
383380
'text_equal': {
384381
'result': '',
385382
},

tests/data/formatters/TextFormatter.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -377,9 +377,6 @@
377377
'sublist_filled_noA': {
378378
'result': '',
379379
},
380-
'text_diff_disabled': {
381-
'result': "- 'A\\nB'\n+ 'B\\nC'\n",
382-
},
383380
'text_equal': {
384381
'result': '',
385382
},

tests/test_diff.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,3 +114,13 @@ def test_text_diff_func_extra_handlers_opt():
114114
got = diff(a, b, extra_handlers=[handlers.TextHandler(context=3)])
115115

116116
assert got == expected
117+
118+
119+
def test_text_diff_func_text_diff_ctx_opt():
120+
a = ['a']
121+
b = ['a\nb']
122+
123+
expected = {'D': [{'D': [{'I': [0, 1, 0, 2]}, {'U': 'a'}, {'A': 'b'}], 'E': 5}]}
124+
got = diff(a, b, text_diff_ctx=3)
125+
126+
assert got == expected

tests/test_patch.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import pytest
22

3-
from nested_diff import Differ, Patcher
3+
from nested_diff import Differ, Patcher, patch
44

55
from tests.data import specific, standard
66

@@ -75,3 +75,7 @@ def test_unsupported_extension():
7575
def test_unsupported_patch_type():
7676
with pytest.raises(ValueError, match='unsupported patch type: module'):
7777
Patcher().patch(None, {'D': pytest}) # module
78+
79+
80+
def test_patch_func():
81+
assert patch('a', {'N': 'b', 'O': 'a'}) == 'b'

0 commit comments

Comments
 (0)