def testAddMember(self): p = policy_simple.Policy('test') good = [ policy_simple.Header(), policy_simple.Term('test'), policy_simple.BlankLine(), policy_simple.CommentLine('test'), policy_simple.Include('other_pol') ] bad = ('', 3, lambda x: x, policy_simple.Field('test')) for member in good: try: p.AddMember(member) except TypeError: self.fail('Policy should accept member "%s"' % member) self.assertEqual(good, p.members) for member in bad: self.assertRaises(TypeError, p.AddMember, member)
def testParseInclude(self): parser = self.Parser('#include other/file #whatever') expected = policy_simple.Include('other/file') pol = parser.Parse() self.assertEqual([expected], pol.members)