Пример #1
0
    def test_glob(self):
        vals = self.vals
        a1 = BlahModel()
        obs = MatchObserver()
        obs.set_model(a1)
        obs.connect("*", self.on_foo)

        a1.meh__foo = 100
        self.assertEqual(vals, [("meh__foo", 100)])

        a1.feh__gah = "coiso"
        self.assertEqual(vals, [("meh__foo", 100), ("feh__gah", "coiso")])
Пример #2
0
    def test_glob(self):
        vals = self.vals
        a1 = BlahModel()
        obs = MatchObserver()
        obs.set_model(a1)
        obs.connect("*", self.on_foo)

        a1.meh__foo = 100
        self.assertEqual(vals, [("meh__foo", 100)])

        a1.feh__gah = "coiso"
        self.assertEqual(vals, [("meh__foo", 100), ("feh__gah", "coiso")])
Пример #3
0
    def test_connection(self):
        vals = self.vals
        a1 = BlahModel()
        obs = MatchObserver()
        obs.set_model(a1)
        subs = obs.connect("*", self.on_foo)

        a1.meh__foo = 100
        self.assertEqual(vals, [("meh__foo", 100)])

        obs.unregister(subs)
        a1.feh__gah = "coiso"
        self.assertEqual(vals, [("meh__foo", 100)])
Пример #4
0
    def test_connection(self):
        vals = self.vals
        a1 = BlahModel()
        obs = MatchObserver()
        obs.set_model(a1)
        subs = obs.connect("*", self.on_foo)

        a1.meh__foo = 100
        self.assertEqual(vals, [("meh__foo", 100)])

        obs.unregister(subs)
        a1.feh__gah = "coiso"
        self.assertEqual(vals, [("meh__foo", 100)])