def _build_policies(self, cp, sections): retval = {} for section in sections: items = self._read_section(cp, section) _, name = section.split(':') type_ = items.pop('type') retval[name] = get_policy_type(type_)(**items) return retval
from aniketos.policy import get_policy_type from nose.tools import eq_ Strict = get_policy_type('strict') def test_strict_policy(): eq_(True, Strict()({})) def test_strict_policy(): violations = { 'foo.py' : { "W100" : [ (1, '') ] } } eq_(False, Strict()(violations))