コード例 #1
0
 def test_instance_sample(self):
   datum1 = Foo()
   datum2 = Foo()
   # Updating the field foo shouldn't change anything
   datum2.foo = 2
   datum3 = Foo()
   # Adding the field bar should change things.
   datum3.bar = "bar"
   self.assertEqual(instance_set([datum1]), [Foo])
   self.assertEqual(instance_set([datum1, datum2]), [Foo])
   self.assertEqual(instance_set([datum1, datum2, datum3]), [Foo, Foo])
コード例 #2
0
 def test_builtin_type_sample(self):
   tags1 = instance_set([1])
   self.assertEqual(tags1, [int])
   tags2 = instance_set([True])
   self.assertEqual(tags2, [bool])