[python-ldap] [PATCH] Tests for the ldif module

Petr Viktorin pviktori at redhat.com
Fri Oct 2 15:28:54 CEST 2015

On 09/30/2015 07:23 PM, Michael Ströder wrote:
> Petr Viktorin wrote:
>> I've written some basic tests for the ldif module.
> I had to restructure this a bit because the LDIF string representations are
> ambigous. So you can only compare the parsed structures.

They are ambiguous, but hopefully the LDIFWriter output is stable (in
the sense that the same records produce the same LDIF output). This is
not a required property, but would be nice if it held.
The original tests always compared either parsed structures or the
LDIFWriter output. The third argument to check_roundtrip() was this
"normalized" LDIF (in case it was different from the input).
This meant tests would break on any change to the output format (not
just changes incompatible with the parser), allowing you to inspect if
it was intended.

Your call: should the LDIFParser+LDIFWriter combination do normalization?

Revert patch attached, should you want to use it. It preserves the
recently added "attr::b64val" test, and adds a new corner case
("attr:\n", as opposed to "attr: \n").

Petr Viktorin
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ldif-tests-revert.patch
Type: text/x-patch
Size: 5546 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/python-ldap/attachments/20151002/a404c91a/attachment.bin>

More information about the python-ldap mailing list