Exemple #1
0
 def testEquals(self):
     assert None == Key()
     assert '' == Key()
     assert Key() == Key()
     assert Key('a') == Key('A')
     assert 'a' == Key('a')
     assert Key('a') != Key('b')
     assert not ('a' != Key('A'))
Exemple #2
0
 def testValidation(self):
     for name in '. 1 _ $'.split() + [object()]:
         try:
             Key(name)
         except cfg.ConfigError:
             pass
         else:
             assert False, 'must not accept {0} as Key name'.format(name)
Exemple #3
0
    def testAssignAdd(self):
        key = Key('a')
        second_key = key

        second_key += 'b'

        assert key is not second_key
        assert 'a.b' == second_key, (second_key)
        assert 'a' == key, (key)
Exemple #4
0
 def testRightAdd(self):
     assert 'a.b' == 'a' + Key('b')
Exemple #5
0
 def testAdd(self):
     assert '' == Key() + Key()
     assert '' == Key() + None
     assert 'string' == Key() + 'string'
     assert 'a.b' == Key('a') + 'b'
Exemple #6
0
 def testConstructor(self):
     assert '' == str(Key())
     assert '' == str(Key(None))
     assert '' == str(Key(str()))
     assert 'a.b' == str(Key('a.b'))
     assert 'a.b' == str(Key('A.B'))