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