Beispiel #1
0
 def testDeletionIsSent(self):
     pm = PropertyLayer(testkey="somevalue")
     mock = Mock()
     pm.wireProperty("testkey", mock.method)
     mock.method.reset_mock()
     del pm["testkey"]
     mock.method.assert_called_once_with(PropertyDeleted)
Beispiel #2
0
 def testSubscribeBeforeSet(self):
     pm = PropertyLayer()
     mock = Mock()
     pm.wireProperty("testkey", mock.method)
     mock.method.assert_not_called()
     pm["testkey"] = "newvalue"
     mock.method.assert_called_once_with("newvalue")
Beispiel #3
0
 def testNoDeletionEventWhenPropertyDoesntExist(self):
     pm = PropertyLayer(otherkey="somevalue")
     mock = Mock()
     pm.wireProperty("testkey", mock.method)
     mock.method.reset_mock()
     with self.assertRaises(KeyError):
         del pm["testkey"]
     mock.method.assert_not_called()