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 testStrIndents(self): f = policy_simple.Field('Testvalue\nTestValue') self.assertEqual('UNKNOWN::Testvalue\n TestValue', str(f))
def testAppendAppends(self): f = policy_simple.Field('Testvalue') f.Append('TESTVALUE') self.assertEqual(f.value, 'TestvalueTESTVALUE')