def test_register_check(self): class TestCheck(policy.Check): pass policy.register('spam', TestCheck) self.assertEqual(policy._checks, dict(spam=TestCheck))
def test_register_check(self): class TestCheck(policy.Check): pass policy.register('spam', TestCheck) self.assertEqual(dict(spam=TestCheck), _checks.registered_checks)
def test_base_check_types_are_public(self): '''Check that those check types are part of public API. They are blessed to be used by library consumers. ''' for check_type in (policy.AndCheck, policy.NotCheck, policy.OrCheck, policy.RuleCheck): class TestCheck(check_type): pass check_str = str(check_type) policy.register(check_str, TestCheck) self.assertEqual( TestCheck, _checks.registered_checks[check_str], message='%s check type is not public.' % check_str)