Exemplo n.º 1
0
 def test_vectors_nonstr(self):
     b = Box(get_lst3())
     keys = ['d', 'e']
     vec0, vec1, labels = b.vectors(keys, labels='dict')
     expected_vec0 = [[12, 30], [13, 31]]
     expected_vec1 = [[1, 2], [1, 2]]
     expected_labels = [{'a': 1, 'b': 1}, {'a': 1, 'b': 2}]
     self.assertListEqual(expected_vec0, vec0)
     self.assertListEqual(expected_vec1, vec1)
     self.assertListEqual(expected_labels, labels)
Exemplo n.º 2
0
 def test_vectors_uncombined(self):
     b = Box(get_lst5())
     keys = ['b', 'e']
     vec0, vec1, labels = b.vectors(keys, combine=False)
     expected_vec0 = [[1, 2], [1, 2]]
     expected_vec1 = [[12, 30], [13, 31]]
     expected_labels = ['a=1', 'a=1']
     self.assertListEqual(expected_vec0, vec0)
     self.assertListEqual(expected_vec1, vec1)
     self.assertListEqual(expected_labels, labels)
Exemplo n.º 3
0
 def test_vectors_indep_keys(self):
     b = Box(get_lst4())
     keys = ['c']
     c, a, b = b.vectors(keys, indep_keys=['a', 'b'])
     expected_c = [4, 5, 6, 7]
     expected_a = [1, 1, 2, 2]
     expected_b = [1, 2, 1, 2]
     self.assertListEqual(expected_c, c)
     self.assertListEqual(expected_a, a)
     self.assertListEqual(expected_b, b)
Exemplo n.º 4
0
 def test_vectors(self):
     b = Box(get_lst3())
     keys = ['d', 'e']
     vec0, vec1, labels = b.vectors(keys)
     expected_vec0 = [[12, 30], [13, 31]]
     expected_vec1 = [[1, 2], [1, 2]]
     expected_labels = ['a=1, b=1', 'a=1, b=2']
     self.assertListEqual(expected_vec0, vec0)
     self.assertListEqual(expected_vec1, vec1)
     self.assertListEqual(expected_labels, labels)
Exemplo n.º 5
0
 def test_vectors_scalar(self):
     b = Box(get_lst4())
     keys = ['c']
     c, labels = b.vectors(keys, labels='dict')
     expected_c = [4, 5, 6, 7]
     expected_labels = [{
         'a': 1,
         'b': 1
     }, {
         'a': 1,
         'b': 2
     }, {
         'a': 2,
         'b': 1
     }, {
         'a': 2,
         'b': 2
     }]
     self.assertListEqual(expected_c, c)
     self.assertListEqual(expected_labels, labels)