Beispiel #1
0
 def test_error_with_non_iterable_type(self):
     with self.assertRaises(ValueError):
         Contract._convert_to_single_entity(None)
Beispiel #2
0
 def test_error_when_type_is_wrong(self):
     with self.assertRaises(ValueError):
         Contract._convert_to_single_entity([None])
Beispiel #3
0
 def test_dict_single_entity_conversion(self):
     entity = Entity()
     self.assertEqual(entity,
                      Contract._convert_to_single_entity({entity: None}))
Beispiel #4
0
 def test_error_when_multiple_values_provided(self):
     with self.assertRaises(ValueError):
         Contract._convert_to_single_entity([Entity(), Entity()])
Beispiel #5
0
 def test_list_single_entity_conversion(self):
     entity = Entity()
     self.assertEqual(entity, Contract._convert_to_single_entity([entity]))