Python: use hash() as temporary workaround to check if two objects with different wrappers are underneath the same.
1.1 --- a/bindings/python/wscript Wed Jul 30 16:36:57 2008 -0400
1.2 +++ b/bindings/python/wscript Fri Aug 01 23:11:42 2008 +0100
1.3 @@ -21,7 +21,7 @@
1.4 os.environ['PYTHONPATH'] = LOCAL_PYBINDGEN_PATH
1.5
1.6 ## https://launchpad.net/pybindgen/
1.7 -REQUIRED_PYBINDGEN_VERSION = (0, 8, 0, 516)
1.8 +REQUIRED_PYBINDGEN_VERSION = (0, 9, 0, 526)
1.9 REQUIRED_PYGCCXML_VERSION = (0, 9, 5)
1.10
1.11
2.1 --- a/utils/python-unit-tests.py Wed Jul 30 16:36:57 2008 -0400
2.2 +++ b/utils/python-unit-tests.py Fri Aug 01 23:11:42 2008 +0100
2.3 @@ -105,8 +105,22 @@
2.4 ptr = ns3.PointerValue()
2.5 mobility.GetAttribute("Position", ptr)
2.6 self.assert_(ptr.GetObject() is not None)
2.7 +
2.8 + def testIdentity(self):
2.9 + csma = ns3.CsmaNetDevice()
2.10 + channel = ns3.CsmaChannel()
2.11 + csma.Attach(channel)
2.12
2.13 + c1 = csma.GetChannel()
2.14 + c2 = csma.GetChannel()
2.15
2.16 + ## FIXME: it is a PyBindGen bug that comparison via hash
2.17 + ## functions is required. However it should be noted that
2.18 + ## hash(channel) here basically returns the self->obj pointer,
2.19 + ## so if hash(c1) == hash(c2) then we know for sure that c1
2.20 + ## and c2 are the same channel, even if with different python
2.21 + ## wrappers.
2.22 + self.assertEqual(hash(c1), hash(c2))
2.23
2.24 if __name__ == '__main__':
2.25 unittest.main()