def test_instaance_one_item_mapping_methods(self): tags = IrcMessageTagsReadOnly(['Kappa']) self.assertEqual(tags, tags) self.assertEqual(tags, IrcMessageTagsReadOnly({'Kappa': True})) self.assertEqual(tags, {'Kappa': True}) self.assertEqual(len(tags.keys()), 1) self.assertEqual(len(tags.values()), 1) self.assertEqual(len(tags.items()), 1) self.assertIn('Kappa', tags.keys()) self.assertIn(IrcMessageTagsKey('Kappa'), tags.keys()) self.assertIn(True, tags.values()) self.assertIn(('Kappa', True), tags.items()) self.assertIn((IrcMessageTagsKey('Kappa'), True), tags.items()) keyIter = iter(tags) self.assertEqual(next(keyIter), 'Kappa') self.assertRaises(StopIteration, next, keyIter)
def test_empty_instance_mapping_methods(self): tags = IrcMessageTagsReadOnly() self.assertEqual(tags, tags) self.assertEqual(tags, IrcMessageTagsReadOnly()) self.assertEqual(tags, {}) self.assertFalse(tags.keys()) self.assertFalse(tags.values()) self.assertFalse(tags.items()) self.assertIsNone(tags.get('Kappa')) keyIter = iter(tags) self.assertRaises(StopIteration, next, keyIter)