def test_event_registry_filter(self): registry = EventRegistry() _codes = { 'MY_CODE': { 'type': LOG_TYPES.SYSTEM, 'level': LOG_LEVELS.HIGH, 'selectable_by': [], 'description': "my code", 'stops_timer': True }, } class MyEvent(BaseEvent): key = 'my_key' codes = _codes registry.register(MyEvent) res = registry.all() self.assertEqual(len(res), 1) self.assertTrue('MY_CODE' in res, res) filt = registry.filter(stops_timer=False) self.assertEqual(len(filt), 0) self.assertFalse('MY_CODE' in filt, filt)
def test_event_registry_filter(self): registry = EventRegistry() _codes = { "MY_CODE": { "type": LOG_TYPES.SYSTEM, "level": LOG_LEVELS.HIGH, "selectable_by": [], "description": "my code", "stops_timer": True, } } class MyEvent(BaseEvent): key = "my_key" codes = _codes registry.register(MyEvent) res = registry.all() self.assertEqual(len(res), 1) self.assertTrue("MY_CODE" in res, res) filt = registry.filter(stops_timer=False) self.assertEqual(len(filt), 0) self.assertFalse("MY_CODE" in filt, filt)