コード例 #1
0
 def test_impl(keys1, values1, keys2, values2):
     a_dict = ConcurrentDict.from_arrays(keys1, values1)
     other_dict = ConcurrentDict.from_arrays(keys2, values2)
     r1 = len(a_dict)
     a_dict.update(other_dict)
     r2 = len(a_dict)
     check_keys = np.array([k in a_dict for k in keys2])
     return r1, r2, np.all(check_keys)
コード例 #2
0
 def test_impl(keys, values):
     a_dict = ConcurrentDict.from_arrays(keys, values)
     dict_iter = iter(a_dict)
     r1 = next(dict_iter)
     r2 = next(dict_iter)
     r3 = next(dict_iter)
     return r1, r2, r3
コード例 #3
0
 def test_impl(key, value):
     a_dict = ConcurrentDict.from_arrays(
         np.array([
             key,
         ]),
         np.array([
             value,
         ]),
     )
     return key in a_dict, 2 * key in a_dict
コード例 #4
0
 def test_impl(key, value):
     a_dict = ConcurrentDict.from_arrays(
         np.array([
             key,
         ]),
         np.array([
             value,
         ]),
     )
     a_dict.pop(key)
     return len(a_dict), a_dict.get(key, None)
コード例 #5
0
        def test_impl(key, value, new_value):
            a_dict = ConcurrentDict.from_arrays(
                np.array([
                    key,
                ]),
                np.array([
                    value,
                ]),
            )

            a_dict[key] = new_value
            return a_dict[key]
コード例 #6
0
 def test_impl(key, value, default):
     a_dict = ConcurrentDict.from_arrays(
         np.array([
             key,
         ]),
         np.array([
             value,
         ]),
     )
     r1 = a_dict.get(key, None)
     r2 = a_dict.get(2 * key, default)
     r3 = a_dict.get(2 * key)
     return r1, r2, r3
コード例 #7
0
 def test_impl(keys, values):
     a_dict = ConcurrentDict.from_arrays(keys, values)
     res = []
     for k, v in a_dict.items():
         res.append((k, v))
     return res
コード例 #8
0
 def test_impl(keys, values):
     a_dict = ConcurrentDict.from_arrays(keys, values)
     res = []
     for k in a_dict.keys():
         res.append(k)
     return res
コード例 #9
0
 def test_impl(keys, values):
     a_dict = ConcurrentDict.from_arrays(keys, values)
     r1 = len(a_dict)
     a_dict.clear()
     r2 = len(a_dict)
     return r1, r2
コード例 #10
0
 def test_impl(keys, values):
     a_dict = ConcurrentDict.from_arrays(keys, values)
     res = list(a_dict.items())  # this relies on working iterator
     return res