Beispiel #1
0
 def test_about_pack_settings_signal(self):
     handler = ContextHandler()
     handler.bind(SimpleWidget)
     widget = SimpleWidget()
     handler.initialize(widget)
     fn = Mock()
     widget.settingsAboutToBePacked.connect(fn)
     handler.pack_data(widget)
     self.assertEqual(1, fn.call_count)
     handler.update_defaults(widget)
     self.assertEqual(2, fn.call_count)
Beispiel #2
0
    def test_pack_settings_stores_version(self):
        handler = ContextHandler()
        handler.bind(SimpleWidget)

        widget = SimpleWidget()
        handler.initialize(widget)
        widget.context_setting = [DummyContext() for _ in range(3)]

        settings = handler.pack_data(widget)
        self.assertIn("context_settings", settings)
        for c in settings["context_settings"]:
            self.assertIn(VERSION_KEY, c.values)