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'))
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)
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)
def testRightAdd(self): assert 'a.b' == 'a' + Key('b')
def testAdd(self): assert '' == Key() + Key() assert '' == Key() + None assert 'string' == Key() + 'string' assert 'a.b' == Key('a') + 'b'
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'))