def test_get_data_type_recognises_dictionaries(self): attribute = Attribute('supportAvailability', self.fixture) dictionary = { "assurance": "Service provider assertion", "value": True } self.assertEqual(attribute.get_data_type(dictionary), 'dictionary')
def test_get_data_type_recognises_functions(self): attribute = Attribute('supportAvailability', self.fixture) def _func(): pass self.assertEqual( attribute.get_data_type(_func), 'function' )
def test_get_data_type_returns_false_for_unrecognised_type(self): attribute = Attribute('supportAvailability', self.fixture) self.assertFalse(attribute.get_data_type(('name', 'address')))
def test_get_data_type_recognises_booleans(self): attribute = Attribute('supportAvailability', self.fixture) self.assertEqual( attribute.get_data_type(True), 'boolean' )
def test_get_data_type_recognises_lists(self): attribute = Attribute('supportAvailability', self.fixture) self.assertEqual( attribute.get_data_type([1, 2]), 'list' )
def test_get_data_type_recognises_unicode_strings(self): attribute = Attribute('supportAvailability', self.fixture) self.assertEqual( attribute.get_data_type(u'24x7x365 with UK based engineers'), 'string' )
def test_get_data_type_recognises_integer(self): attribute = Attribute('supportAvailability', self.fixture) self.assertEqual( attribute.get_data_type(99), 'integer' )
def test_get_data_type_recognises_floats(self): attribute = Attribute('supportAvailability', self.fixture) self.assertEqual( attribute.get_data_type(99.99), 'float' )