Esempio n. 1
0
 def test_record_values(self):
     r = Record(["name", "age", "married"], ["Alice", 33, True])
     self.assertEqual(r.values(), ("Alice", 33, True))
     self.assertEqual(r.values("name"), ("Alice", ))
     self.assertEqual(r.values("age", "name"), (33, "Alice"))
     self.assertEqual(r.values("age", "name", "shoe size"),
                      (33, "Alice", None))
     self.assertEqual(r.values(0, "name"), ("Alice", "Alice"))
     self.assertEqual(r.values(0), ("Alice", ))
     self.assertEqual(r.values(1, 0), (33, "Alice"))
     with self.assertRaises(IndexError):
         _ = r.values(1, 0, 999)
 def test_record_values(self):
     a_record = Record(["name", "empire"], ["Nigel", "The British Empire"])
     assert list(a_record.values()) == ["Nigel", "The British Empire"]