def test_transformation_2 (self): test = NotifyTestObject () variable = Variable (0) variable.transform (math.floor).store (test.simple_handler) variable.value = 5 variable.value = 5.6 variable.value = 15.7 variable.value = 16 variable.value = 16.5 variable.value = 16.2 test.assert_results (0, 5, 15, 16)
def test_transformation_1 (self): variable = Variable (0) floor = variable.transform (math.floor) self.assertEqual (floor.value, 0) self.assert_(not floor.mutable) variable.value = 10.5 self.assertEqual (floor.value, 10) variable.value = 15 self.assertEqual (floor.value, 15)