simplify api by abstracting layer changes
This commit is contained in:
@ -77,12 +77,6 @@ class PropertyCarouselTest(TestCase):
|
||||
with self.assertRaises(KeyError):
|
||||
pc.switch("doesntmatter")
|
||||
|
||||
def testHasLayer(self):
|
||||
pc = PropertyCarousel()
|
||||
pc.addLayer("testkey", PropertyLayer())
|
||||
self.assertTrue(pc.hasLayer("testkey"))
|
||||
self.assertFalse(pc.hasLayer("otherkey"))
|
||||
|
||||
def testRemoveLayer(self):
|
||||
pc = PropertyCarousel()
|
||||
pl = PropertyLayer(testkey="testvalue")
|
||||
@ -117,3 +111,15 @@ class PropertyCarouselTest(TestCase):
|
||||
pc = PropertyCarousel()
|
||||
with self.assertRaises(PropertyWriteError):
|
||||
pc["testkey"] = "testvalue"
|
||||
|
||||
def testSendsChangesIfActiveLayerIsReplaced(self):
|
||||
pc = PropertyCarousel()
|
||||
pl = PropertyLayer(testkey="testvalue")
|
||||
pc.addLayer("x", pl)
|
||||
pc.switch("x")
|
||||
self.assertEqual(pc["testkey"], "testvalue")
|
||||
mock = Mock()
|
||||
pc.wire(mock.method)
|
||||
pl = PropertyLayer(testkey="othervalue")
|
||||
pc.addLayer("x", pl)
|
||||
mock.method.assert_called_once_with({"testkey": "othervalue"})
|
||||
|
Reference in New Issue
Block a user