Esempio n. 1
0
 def test__namesOfDoubleAttributes(self):
     """check Attributes._namesOfDoubleAttributes()
     """
     a = Attributes()
     self.assertEqual(0, len(a._namesOfDoubleAttributes()))
     pq = PairQuantity()
     self.assertNotEqual(0, len(pq._namesOfDoubleAttributes()))
     self.assertFalse('bar' in pq._namesOfDoubleAttributes())
     pq._registerDoubleAttribute('bar')
     self.assertTrue('bar' in pq._namesOfDoubleAttributes())
     return
Esempio n. 2
0
 def test_garbage_collection(self):
     """check garbage collection for Python defined Attributes
     """
     # check if attributes are garbage collected
     pq = PairQuantity()
     wpq = weakref.ref(pq)
     self.assertFalse(wpq() is None)
     pq._registerDoubleAttribute('foo')
     pq.foo = 45
     self.assertEqual(45, pq._getDoubleAttr('foo'))
     del pq
     self.assertTrue(wpq() is None)
     return