Beispiel #1
0
 def test_eq_with_an_object_of_ExtraProperties(self):
     a_dict = {'foo': 'bar', 'snitch': 'golden'}
     extra_properties = domain.ExtraProperties(a_dict)
     ref_extra_properties = domain.ExtraProperties()
     ref_extra_properties['snitch'] = 'golden'
     ref_extra_properties['foo'] = 'bar'
     self.assertEqual(ref_extra_properties, extra_properties)
Beispiel #2
0
 def test_eq_with_unequal_ExtraProperties_object(self):
     a_dict = {'foo': 'bar', 'snitch': 'golden'}
     extra_properties = domain.ExtraProperties(a_dict)
     ref_extra_properties = domain.ExtraProperties()
     ref_extra_properties['gnitch'] = 'solden'
     ref_extra_properties['boo'] = 'far'
     self.assertFalse(extra_properties.__eq__(ref_extra_properties))
Beispiel #3
0
 def test_eq_with_incompatible_object(self):
     a_dict = {'foo': 'bar', 'snitch': 'golden'}
     extra_properties = domain.ExtraProperties(a_dict)
     random_list = ['foo', 'bar']
     self.assertFalse(extra_properties.__eq__(random_list))
Beispiel #4
0
 def test_eq_with_uneqal_dict(self):
     a_dict = {'foo': 'bar', 'snitch': 'golden'}
     extra_properties = domain.ExtraProperties(a_dict)
     ref_extra_properties = {'boo': 'far', 'gnitch': 'solden'}
     self.assertFalse(extra_properties.__eq__(ref_extra_properties))
Beispiel #5
0
 def test_eq_with_a_dict(self):
     a_dict = {'foo': 'bar', 'snitch': 'golden'}
     extra_properties = domain.ExtraProperties(a_dict)
     ref_extra_properties = {'foo': 'bar', 'snitch': 'golden'}
     self.assertEqual(ref_extra_properties, extra_properties)
Beispiel #6
0
 def test_len_with_non_zero_items(self):
     extra_properties = domain.ExtraProperties()
     extra_properties['foo'] = 'bar'
     extra_properties['snitch'] = 'golden'
     self.assertEqual(2, len(extra_properties))
Beispiel #7
0
 def test_len_with_zero_items(self):
     extra_properties = domain.ExtraProperties()
     self.assertEqual(0, len(extra_properties))
Beispiel #8
0
 def test_delitem(self):
     a_dict = {'foo': 'bar', 'snitch': 'golden'}
     extra_properties = domain.ExtraProperties(a_dict)
     del extra_properties['foo']
     self.assertRaises(KeyError, extra_properties.__getitem__, 'foo')
     self.assertEqual('golden', extra_properties['snitch'])
Beispiel #9
0
 def test_setitem(self):
     a_dict = {'foo': 'bar', 'snitch': 'golden'}
     extra_properties = domain.ExtraProperties(a_dict)
     extra_properties['foo'] = 'baz'
     self.assertEqual('baz', extra_properties['foo'])
Beispiel #10
0
 def test_getitem_with_no_items(self):
     extra_properties = domain.ExtraProperties()
     self.assertRaises(KeyError, extra_properties.__getitem__, 'foo')