示例#1
0
 def test_tracker_has_changed(self):
     ins = Dummy()
     tracker = FieldTracker(ins, ("name", ))
     self.assertFalse(tracker.has_changed("name"))
     ins.age = 12
     self.assertFalse(tracker.has_changed("age"))
     ins.name = "Hello"
     self.assertTrue(tracker.has_changed("name"))
示例#2
0
 def test_tracker_reset(self):
     ins = Dummy()
     tracker = FieldTracker(ins, ("name", ))
     ins.name = "Spider"
     self.assertTrue(tracker.has_changed("name"))
     tracker.reset()
     self.assertFalse(tracker.has_changed("name"))