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

Andreas Schneider asn at samba.org
Tue Jan 29 07:56:59 UTC 2019


On Monday, 28 January 2019 02:20:50 CET Douglas Bagnall via samba-technical 
wrote:
> 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!

RB+

-- 
Andreas Schneider                      asn at samba.org
Samba Team                             www.samba.org
GPG-ID:     8DFF53E18F2ABC8D8F3C92237EE0FC4DCC014E3D





More information about the samba-technical mailing list