New submission from vincenzo gisondi:

I found an anomaly on identification of changes as Diff Style (^).

There are the tests that i done:

1) First Test (only one character is different)

>>> a = "Hello Vincenzo\n".splitlines(1)
>>> b = "Hello Vincenza\n".splitlines(1)
>>> a
['Hello Vincenzo\n']
>>> b
['Hello Vincenza\n']
>>> diff = difflib.ndiff(a,b)
>>> print(''.join(diff))
- Hello Vincenzo
?              ^
+ Hello Vincenza
?              ^


2) Second Test (two characters are differents)

>>> a = "Hello Vincenzo\n".splitlines(1)
>>> b = "Hello Vincensa\n".splitlines(1)
>>> a
['Hello Vincenzo\n']
>>> b
['Hello Vincensa\n']
>>> diff = difflib.ndiff(a,b)
>>> print(''.join(diff))
- Hello Vincenzo
?             ^^
+ Hello Vincensa
?             ^^

3) Third Test (three characters are differents)

>>> a = "Hello Vincenzo\n".splitlines(1)
>>> b = "Helto Bincenza\n".splitlines(1)
>>> a
['Hello Vincenzo\n']
>>> b
['Helto Bincenza\n']
>>> diff = difflib.ndiff(a,b)
>>> print(''.join(diff))
- Hello Vincenzo
?    ^  ^      ^
+ Helto Bincenza
?    ^  ^      ^

4) Fourth test (four characters are differents -> Anomaly)

>>> a = "Hello Vincenzo\n".splitlines(1)
>>> b = "Halto Bincenza\n".splitlines(1)
>>> a
['Hello Vincenzo\n']
>>> b
['Halto Bincenza\n']
>>> diff = difflib.ndiff(a,b)
>>> print(''.join(diff))
- Hello Vincenzo
+ Halto Bincenza

In this last test I expected 4 "^" characters as in previous tests, like this:

- Hello Vincenzo
?  ^ ^  ^      ^
+ Halto Bincenza
?  ^ ^  ^      ^

but I have a response completly different. This is a Bug or I did not 
understand something :)

Thank you very much for your support.

----------
components: Library (Lib)
messages: 274023
nosy: vincenzo gisondi
priority: normal
severity: normal
status: open
title: Difflib.ndiff (Problem on identification of changes as Diff Style)
type: behavior
versions: Python 2.7

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue27913>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to