def test_load_attr_as_list_of_on_list_mixed_none(self): with self.assertRaises(TypeError): info = Info({'sub_info_data': [None, { 'test': 'test' }]}, preserve_data=True) info._load_attr_as_list_of('sub_info_data', Info)
def test_load_attr_as_list_of_on_string(self): with self.assertRaises(TypeError): info = Info({'sub_info_data': 'test'}, preserve_data=True) info._load_attr_as_list_of('sub_info_data', Info)
def test_load_attr_as_list_of_on_none(self): info = Info({'test': None}, preserve_data=True) info._load_attr_as_list_of('test', Info) self.assertEqual(info.test, [])
def test_load_attr_as_list_of_on_string(self): with self.assertRaises(TypeError): info = Info({'sub_info_data': 'test'}, preserve_data=True) info._load_attr_as_list_of('sub_info_data', Info)
def test_load_attr_as_list_of_on_list_mixed_none(self): with self.assertRaises(TypeError): info = Info({'sub_info_data': [None, {'test':'test'}]}, preserve_data=True) info._load_attr_as_list_of('sub_info_data', Info)
def test_load_attr_as_list_of_on_none(self): info = Info({'test': None}, preserve_data=True) info._load_attr_as_list_of('test', Info) self.assertEqual(info.test, [])