Example #1
0
 def test_DKG_array2(self):
     store = {'array': np.array([[1, 2, 3, 4, 5, 6], [7, 8, 9, 10, 11, 12]])}
     result = outputting.dictKeyGen(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]]))]),
                       1)
     assert (result[0]['array'] == correct_result[0]['array']).all()
     assert result[1] == correct_result[1]
Example #2
0
 def test_DKG_dict3(self):
     store = {'dict': {1: {3: "a"}, 2: "b"}}
     result = outputting.dictKeyGen(store)
     correct_result = (collections.OrderedDict([('dict', collections.OrderedDict([(1, collections.OrderedDict([(3, None)])),
                                                                                  (2, None)]))]),
                       1)
     assert result[0]['dict'] == correct_result[0]['dict']
     assert result[1] == correct_result[1]
Example #3
0
 def test_DKG_array3(self):
     store = {'array': np.array([[1, 2], [3, 4], [5, 6], [7, 8], [9, 10], [11, 12]])}
     result = outputting.dictKeyGen(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]]))]),
                       1)
     assert (result[0]['array'] == correct_result[0]['array']).all()
     assert result[1] == correct_result[1]
Example #4
0
 def test_DKG_dict2(self):
     store = {'dict': {1: [1, 2, 3], 2: [[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11], [12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22]]}}
     result = outputting.dictKeyGen(store, abridge=True)
     correct_result = (collections.OrderedDict([('dict', collections.OrderedDict([(1, np.array([[0], [1], [2]])),
                                                                                  (2, None)]))]),
                       1)
     assert (result[0]['dict'][1] == correct_result[0]['dict'][1]).all()
     assert result[0]['dict'][2] == correct_result[0]['dict'][2]
     assert result[1] == correct_result[1]
Example #5
0
 def test_DKG_array(self):
     store = {'array': np.array([1, 2, 3])}
     result = outputting.dictKeyGen(store)
     correct_result = (collections.OrderedDict([('array', np.array([[0], [1], [2]]))]), 1)
     assert (result[0]['array'] == correct_result[0]['array']).all()
     assert result[1] == correct_result[1]
Example #6
0
 def test_DKG_num(self):
     store = {'num': 23.6}
     result = outputting.dictKeyGen(store)
     correct_result = (collections.OrderedDict([('num', None)]), 1)
     assert result[0] == correct_result[0]
     assert result[1] == correct_result[1]
Example #7
0
 def test_DKG_list1(self):
     store = {'list': [1, 2, 3, 4, 5, 6]}
     result = outputting.dictKeyGen(store)
     correct_result = (collections.OrderedDict([('list', np.array([[0], [1], [2], [3], [4], [5]]))]), 1)
     assert (result[0]['list'] == correct_result[0]['list']).all()
     assert result[1] == correct_result[1]
Example #8
0
 def test_DKG_string(self):
     store = {'string': 'string'}
     result = outputting.dictKeyGen(store)
     correct_result = (collections.OrderedDict([('string', None)]), 1)
     assert result[0] == correct_result[0]
     assert result[1] == correct_result[1]
Example #9
0
 def test_DKG_none(self):
     store = {}
     result = outputting.dictKeyGen(store)
     correct_result = (collections.OrderedDict(), None)
     assert result[0] == correct_result[0]
     assert result[1] == correct_result[1]