def test_format_instances_response(self): features = ['a_var', 'c_var', 'd_var'] header, datarows = format_instances(self.instances, features) self.assertEqual(header, ['a_var', 'c_var', 'd_var']) self.assertEqual(datarows, [[ 'aval', 'cval', 'dval', ] for _ in xrange(len(self.instances))])
def test_format_instances_response_nonexistantfeature(self): format_instances(self.instances, ['robot_not_a_real_feature'])
def test_format_instances_response_nofeatures(self): header, datarows = format_instances(self.instances, []) self.assertEqual(header, []) self.assertEqual(datarows, [[] for _ in xrange(len(self.instances))])
def test_format_instances_response_noinstances(self): features = ['a_var'] header, datarows = format_instances([], features) self.assertEqual(header, features) self.assertEqual(datarows, [])