def test_equality(self): res = [common.Identifier(yaml.load(""" nice: Test Part """))] res.append(common.Identifier({'nice' : 'Test Part', 'safe' : 'Test_Part'})) self.assertTrue(res[0] == res[0]) self.assertFalse(res[0] == res[1]) self.assertTrue(res[0] != res[1]) self.assertFalse(res[0] != res[0])
def test_check(self): self.assertRaises( ValueError, lambda: common.Identifier( yaml.load(u""" nice: Test Part with/Garba%;üe safe: Test Part with/Garba%;üe """)))
def test_sanitize(self): res = common.Identifier( yaml.load(u""" nice: Test Part with/Garba%;üe """)) self.assertEqual(res.safe, 'TestPartWithgarbae')
def test_init(self): res = common.Identifier(yaml.load(""" nice: Test Part """)) self.assertEqual(res.nice, 'Test Part') self.assertEqual(res.safe, 'TestPart')