def test_record_keys(self): r = Record(R_AB, (42, 43)) vv = r.keys() self.assertEqual(tuple(vv), ('a', 'b')) # test invalid record with self.assertRaisesRegex(TypeError, 'not iterable'): Record(None, (42, 43)).keys()
def test_record_empty(self): r = Record(None, ()) self.assertEqual(r, ()) self.assertLess(r, (1,)) self.assertEqual(len(r), 0) self.assertFalse(r) self.assertNotIn('a', r) self.assertEqual(repr(r), '<Record>') self.assertEqual(str(r), '<Record>') with self.assertRaisesRegex(KeyError, 'aaa'): r['aaa'] self.assertEqual(dict(r.items()), {}) self.assertEqual(list(r.keys()), []) self.assertEqual(list(r.values()), [])
def test_record_keys(self): r = Record(R_AB, (42, 43)) vv = r.keys() self.assertEqual(tuple(vv), ('a', 'b')) self.assertEqual(list(Record(None, (42, 43)).keys()), [])