Beispiel #1
0
 def test_FDKS_dict2(self):
     store = [{'dict': {1: [1, 2, 3], 2: [[1, 2], [3, 4]]}}]
     result = outputting.flatDictKeySet(store)
     correct_result = collections.OrderedDict([('dict', collections.OrderedDict([(1, np.array([[0], [1], [2]])),
                                                                                  (2, [[0, 0], [1, 0],
                                                                                       [0, 1], [1, 1]])]))])
     assert (result['dict'][1] == correct_result['dict'][1]).all()
     assert (result['dict'][2] == correct_result['dict'][2]).all()
Beispiel #2
0
 def test_FDKS_dict3(self):
     store = [{'dict': {1: {3: "a"}, 2: "b"}}]
     result = outputting.flatDictKeySet(store)
     correct_result = collections.OrderedDict([('dict', collections.OrderedDict([(1, collections.OrderedDict([(3, None)])),
                                                                                  (2, None)]))])
     assert result['dict'] == correct_result['dict']
Beispiel #3
0
 def test_FDKS_array2(self):
     store = [{'array': np.array([[1, 2, 3, 4, 5, 6], [7, 8, 9, 10, 11, 12]])}]
     result = outputting.flatDictKeySet(store)
     correct_result = collections.OrderedDict([('array', np.array([[0, 0], [1, 0], [0, 1], [1, 1], [0, 2], [1, 2], [0, 3], [1, 3], [0, 4], [1, 4],
                                                                    [0, 5], [1, 5]]))])
     assert (result['array'] == correct_result['array']).all()
Beispiel #4
0
 def test_FDKS_array3(self):
     store = [{'array': np.array([[1, 2], [3, 4], [5, 6], [7, 8], [9, 10], [11, 12]])}]
     result = outputting.flatDictKeySet(store)
     correct_result = collections.OrderedDict([('array', np.array([[0, 0], [1, 0], [2, 0], [3, 0], [4, 0], [5, 0], [0, 1], [1, 1], [2, 1], [3, 1],
                                                                    [4, 1], [5, 1]]))])
     assert (result['array'] == correct_result['array']).all()
Beispiel #5
0
 def test_FDKS_array(self):
     store = [{'array': np.array([1, 2, 3])}]
     result = outputting.flatDictKeySet(store)
     correct_result = collections.OrderedDict([('array', np.array([[0], [1], [2]]))])
     assert (result['array'] == correct_result['array']).all()
Beispiel #6
0
 def test_FDKS_num(self):
     store = [{'num': 23.6}]
     result = outputting.flatDictKeySet(store)
     correct_result = collections.OrderedDict([('num', None)])
     assert result == correct_result
Beispiel #7
0
 def test_FDKS_list1(self):
     store = [{'list': [1, 2, 3, 4, 5, 6]}]
     result = outputting.flatDictKeySet(store)
     correct_result = collections.OrderedDict([('list', np.array([[0], [1], [2], [3], [4], [5]]))])
     assert (result['list'] == correct_result['list']).all()
Beispiel #8
0
 def test_FDKS_string(self):
     store = [{'string': 'string'}]
     result = outputting.flatDictKeySet(store)
     correct_result = collections.OrderedDict([('string', None)])
     assert result == correct_result
Beispiel #9
0
 def test_FDKS_none(self):
     store = []
     result = outputting.flatDictKeySet(store)
     correct_result = collections.OrderedDict()
     assert result == correct_result