示例#1
0
 def test_geometry_getters_and_setters(self):
     sample = Sample()
     sample.setThickness(12.5)
     self.assertEqual(sample.getThickness(), 12.5)
     sample.setHeight(10.2)
     self.assertEqual(sample.getHeight(), 10.2)
     sample.setWidth(5.9)
     self.assertEqual(sample.getWidth(), 5.9)
示例#2
0
 def do_test_copyable(self, copy_op):
     original = Sample()
     width = 1.0
     height = 2.0
     thickness = 3.0
     original.setThickness(thickness)
     original.setHeight(height)
     original.setWidth(width)
     # make copy
     cp = copy_op(original)
     # Check identity different
     self.assertNotEqual(id(original), id(cp))
     # Simple tests that cp is equal to original
     self.assertEqual(original.getHeight(), cp.getHeight())
     self.assertEqual(original.getWidth(), cp.getWidth())
     self.assertEqual(original.getThickness(), cp.getThickness())
     # Check really did succeed and is not tied in any way to original
     del original
     self.assertTrue(id(cp) > 0)
     self.assertEqual(height, cp.getHeight())
     self.assertEqual(width, cp.getWidth())
     self.assertEqual(thickness, cp.getThickness())