def test_parse(self): kd = pubsub.key_to_attr(self.key) self.assertEqual(len(kd), 4) self.assertTrue(kd.has_key('Type')) self.assertTrue(kd.has_key('Representation')) self.assertTrue(kd.has_key('Compression')) self.assertTrue(kd.has_key('Result')) self.assertEqual(kd['Type'], 'win_events') self.assertEqual(kd['Representation'], 'string') self.assertEqual(kd['Compression'], 'False') self.assertEqual(kd['Result'], 'False')
def test_parse_noright(self): kd = pubsub.key_to_attr("Type=win_events.Representation=") self.assertEqual(len(kd), 1)
def test_parse_noleft(self): kd = pubsub.key_to_attr("Type=win_events.=string") self.assertEqual(len(kd), 1)
def test_parse_dotnoleft(self): kd = pubsub.key_to_attr(".Type=win_events.Representation=string") self.assertEqual(len(kd), 2)
def test_parse_empty(self): kd = pubsub.key_to_attr("") self.assertEqual(len(kd), 0)