def test_once(): """test event registering with the once method""" obs = Observable() def once_test(): pass obs.once("once_test", once_test) assert len(obs._events["once_test"]) == 1 assert obs.trigger("once_test") assert obs._events["once_test"] == []
def test_once(): """test event registering with the once method""" obs = Observable() nose.assert_false(obs.events) def once_test(): pass obs.once("once_test", once_test) nose.assert_equals(len(obs.events["once_test"]), 1) nose.assert_true(obs.trigger("once_test")) nose.assert_equals(obs.events["once_test"], [])