Exemple #1
0
 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))])
Exemple #2
0
 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))])
Exemple #3
0
 def test_format_instances_response_nonexistantfeature(self):
     format_instances(self.instances, ['robot_not_a_real_feature'])
Exemple #4
0
 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))])
Exemple #5
0
 def test_format_instances_response_noinstances(self):
     features = ['a_var']
     header, datarows = format_instances([], features)
     self.assertEqual(header, features)
     self.assertEqual(datarows, [])
Exemple #6
0
 def test_format_instances_response_nonexistantfeature(self):
     format_instances(self.instances, ['robot_not_a_real_feature'])
Exemple #7
0
 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))])
Exemple #8
0
 def test_format_instances_response_noinstances(self):
     features = ['a_var']
     header, datarows = format_instances([], features)
     self.assertEqual(header, features)
     self.assertEqual(datarows, [])