[PATCH] ldb: The test api.py should not rely on order of entries in

Douglas Bagnall douglas.bagnall at catalyst.net.nz
Mon Jan 28 01:20:50 UTC 2019


On 23/01/19 3:00 AM, Lukas Slebodnik wrote:

> I've just realized that unreliable order of entries is already solved
> in the test for python3
> 
>     def test_repr(self):
>         self.msg.dn = ldb.Dn(ldb.Ldb(), "dc=foo29")
>         self.msg["dc"] = b"foo"
>         if PY3:
>             self.assertIn(repr(self.msg), [
>                 "Message({'dn': Dn('dc=foo29'), 'dc': MessageElement([b'foo'])})",
>                 "Message({'dc': MessageElement([b'foo']), 'dn': Dn('dc=foo29')})",
>             ])
>             self.assertIn(repr(self.msg.text), [
>                 "Message({'dn': Dn('dc=foo29'), 'dc': MessageElement([b'foo'])}).text",
>                 "Message({'dc': MessageElement([b'foo']), 'dn': Dn('dc=foo29')}).text",
>             ])
> 
> Therefore we can use the same approach for python2. There will be just
> difference between bytes and strings.

Yes. RB+.

Actually with 3.6+, the order of entries should be reliable given the
new python dict behaviour (the dn always comes first).

Another reviewer please!

Douglas



More information about the samba-technical mailing list