Author: Nilesh Patra <nilesh@nileshpatra.info>
Description: Fix tests
--- a/tests/asv_bench/benchmarks/count_if.py
+++ b/tests/asv_bench/benchmarks/count_if.py
@@ -28,7 +28,7 @@
         N=100_000
         self.set = PyObjectSet_from(x<<32 for x in range(N))
         np.random.seed(42)
-        self.query = np.random.randint(0,N,N).astype(np.object)
+        self.query = np.random.randint(0,N,N).astype(object)
 
     def time_countif(self):
         count_if_pyobject(self.query, self.set)
--- a/tests/asv_bench/benchmarks/map_methods.py
+++ b/tests/asv_bench/benchmarks/map_methods.py
@@ -7,14 +7,14 @@
                          np.int64: cyk.Int64toInt64Map_to,
                          np.float64 : cyk.Float64toInt64Map_to,
                          np.float32 : cyk.Float32toInt32Map_to,
-                         np.object : cyk.PyObjectMap_to,
+                         object : cyk.PyObjectMap_to,
 }
 
 CREATOR_FROM_INT      = {np.int32: cyk.Int32toInt32Map_from_buffers,
                          np.int64: cyk.Int64toInt64Map_from_buffers,
                          np.float64 : cyk.Float64toInt64Map_from_buffers,
                          np.float32 : cyk.Float32toInt32Map_from_buffers,
-                         np.object : cyk.PyObjectMap_from_buffers,
+                         object : cyk.PyObjectMap_from_buffers,
 }
 
 
@@ -22,7 +22,7 @@
                  np.int64: np.int64,
                  np.float64 : np.int64,
                  np.float32 : np.int32,
-                 np.object : np.object,
+                 object : object,
 }
 
 
@@ -32,7 +32,7 @@
 class MapToWithArange:
 
     params = [ 
-        [np.float64, np.float32, np.int64, np.int32, np.object],  #
+        [np.float64, np.float32, np.int64, np.int32, object],  #
         [1_000, 2_000, 8_000, 10_000, 100_000, 1_000_000], #problem when quadratic behavior is triggered: [10, 100, 1000, 2_000, 8_000, 10_000, 100_000, 256_000, 1_000_000, 10_000_000],
     ]
     param_names = ["dtype", "M"]
@@ -51,7 +51,7 @@
 class MapToWithRandom:
 
     params = [ 
-        [np.float64, np.float32, np.int64, np.int32, np.object],  #
+        [np.float64, np.float32, np.int64, np.int32, object],  #
         [1_000, 2_000, 8_000, 10_000, 100_000, 1_000_000], #problem when quadratic behavior is triggered: [10, 100, 1000, 2_000, 8_000, 10_000, 100_000, 256_000, 1_000_000, 10_000_000],
     ]
     param_names = ["dtype", "M"]
--- a/tests/perf_tests/map_object_vs_int64_via_buffer.py
+++ b/tests/perf_tests/map_object_vs_int64_via_buffer.py
@@ -31,7 +31,7 @@
 
 if True:  
     perfplot.show(
-        setup = lambda n : (np.arange(n, dtype = np.object), np.arange(n, dtype=np.int64), np.arange(n, dtype=np.int32)),
+        setup = lambda n : (np.arange(n, dtype = object), np.arange(n, dtype=np.int64), np.arange(n, dtype=np.int32)),
         n_range=[2**k for k in range(18)],
         kernels=[
             pyobjectset_from_buffer,
--- a/tests/perf_tests/object_vs_int64_via_buffer.py
+++ b/tests/perf_tests/object_vs_int64_via_buffer.py
@@ -35,7 +35,7 @@
 
 if True:  
     perfplot.show(
-        setup = lambda n : (np.arange(n, dtype = np.object), np.arange(n, dtype=np.int64), np.arange(n, dtype=np.int32)),
+        setup = lambda n : (np.arange(n, dtype = object), np.arange(n, dtype=np.int64), np.arange(n, dtype=np.int32)),
         n_range=[2**k for k in range(18)],
         kernels=[
             pyobjectset_from_buffer,
--- a/tests/unit_tests/test_all.py
+++ b/tests/unit_tests/test_all.py
@@ -100,7 +100,7 @@
 class TestAllPyObject(UnitTestMock): 
     def test_all_yes(self):
         s=PyObjectSet_from([2,4,666])
-        a=np.array([2,4,666]*6, dtype=np.object)
+        a=np.array([2,4,666]*6, dtype=object)
         result=all_pyobject(a,s)
         self.assertEqual(result, True)
 
@@ -112,7 +112,7 @@
 
     def test_all_last_no(self):
         s=PyObjectSet_from([2,4,666])
-        a=np.array([2,4,666]*6+[3], dtype=np.object)
+        a=np.array([2,4,666]*6+[3], dtype=object)
         result=all_pyobject(a,s)
         self.assertEqual(result, False)
 
@@ -124,7 +124,7 @@
 
     def test_all_empty(self):
         s=PyObjectSet_from([])
-        a=np.array([], dtype=np.object)
+        a=np.array([], dtype=object)
         result=all_pyobject(a,s)
         self.assertEqual(result, True)
 
@@ -136,7 +136,7 @@
 
     def test_all_empty_set(self):
         s=PyObjectSet_from([])
-        a=np.array([1], dtype=np.object)
+        a=np.array([1], dtype=object)
         result=all_pyobject(a,s)
         self.assertEqual(result, False)
 
@@ -158,7 +158,7 @@
         self.assertEqual(all_pyobject(None,s), True)
 
     def test_dbnone(self):
-        a=np.array([1], dtype=np.object)
+        a=np.array([1], dtype=object)
         self.assertEqual(all_pyobject(a,None), False)
 
     def test_dbnone_from_iter(self):
--- a/tests/unit_tests/test_any.py
+++ b/tests/unit_tests/test_any.py
@@ -93,7 +93,7 @@
 class TestAnyPyObject(UnitTestMock): 
     def test_any_no(self):
         s=PyObjectSet_from([2,4,666])
-        a=np.array([1,3,333]*6, dtype=np.object)
+        a=np.array([1,3,333]*6, dtype=object)
         result=any_pyobject(a,s)
         self.assertEqual(result, False)
 
@@ -105,7 +105,7 @@
 
     def test_any_last_yes(self):
         s=PyObjectSet_from([2,4,666])
-        a=np.array([1,3,333]*6+[2], dtype=np.object)
+        a=np.array([1,3,333]*6+[2], dtype=object)
         result=any_pyobject(a,s)
         self.assertEqual(result, True)
 
@@ -117,7 +117,7 @@
 
     def test_any_empty(self):
         s=PyObjectSet_from([])
-        a=np.array([], dtype=np.object)
+        a=np.array([], dtype=object)
         result=any_pyobject(a,s)
         self.assertEqual(result, False)
 
@@ -129,7 +129,7 @@
 
     def test_any_empty_set(self):
         s=PyObjectSet_from([])
-        a=np.array([1], dtype=np.object)
+        a=np.array([1], dtype=object)
         result=any_pyobject(a,s)
         self.assertEqual(result, False)
 
@@ -151,7 +151,7 @@
         self.assertEqual(any_pyobject(None,s), False)
 
     def test_dbnone(self):
-        a=np.array([1], dtype=np.object)
+        a=np.array([1], dtype=object)
         self.assertEqual(any_pyobject(a,None), False)
 
     def test_dbnone_from_iter(self):
--- a/tests/unit_tests/test_count_if.py
+++ b/tests/unit_tests/test_count_if.py
@@ -92,7 +92,7 @@
 class TestCountIfPyObject(UnitTestMock): 
     def test_count_if_all(self):
         s=PyObjectSet_from([2,4,666])
-        a=np.array([2,4,666]*6, dtype=np.object)
+        a=np.array([2,4,666]*6, dtype=object)
         result=count_if_pyobject(a,s)
         self.assertEqual(result, 18)
 
@@ -104,7 +104,7 @@
 
     def test_count_if_but_last(self):
         s=PyObjectSet_from([2,4,666])
-        a=np.array([2,4,666]*6+[2, 1], dtype=np.object)
+        a=np.array([2,4,666]*6+[2, 1], dtype=object)
         result=count_if_pyobject(a,s)
         self.assertEqual(result, 19)
 
@@ -116,7 +116,7 @@
 
     def test_count_if_empty(self):
         s=PyObjectSet_from([])
-        a=np.array([], dtype=np.object)
+        a=np.array([], dtype=object)
         result=count_if_pyobject(a,s)
         self.assertEqual(result, 0)
 
@@ -128,7 +128,7 @@
 
     def test_count_if_empty_set(self):
         s=PyObjectSet_from([])
-        a=np.array([1], dtype=np.object)
+        a=np.array([1], dtype=object)
         result=count_if_pyobject(a,s)
         self.assertEqual(result, 0)
 
@@ -150,7 +150,7 @@
         self.assertEqual(count_if_pyobject(None,s), 0)
 
     def test_dbnone(self):
-        a=np.array([1], dtype=np.object)
+        a=np.array([1], dtype=object)
         self.assertEqual(count_if_pyobject(a,None), 0)
 
     def test_dbnone_from_iter(self):
--- a/tests/unit_tests/test_create_maps.py
+++ b/tests/unit_tests/test_create_maps.py
@@ -80,8 +80,8 @@
             import numpy as np
         except:
             return # well what should I do?
-        keys=np.array([1,2,3], dtype=np.object)
-        vals=np.array([4,5,6], dtype=np.object)
+        keys=np.array([1,2,3], dtype=object)
+        vals=np.array([4,5,6], dtype=object)
         m=PyObjectMap_from_buffers(keys, vals, 2.0)
         self.assertEqual(len(m), len(keys))
         for x,y in zip(keys, vals):
@@ -93,8 +93,8 @@
             import numpy as np
         except:
             return # well what should I do?
-        keys=np.array([1,2,3], dtype=np.object)
-        vals=np.array([4,5,6,7], dtype=np.object)
+        keys=np.array([1,2,3], dtype=object)
+        vals=np.array([4,5,6,7], dtype=object)
         m=PyObjectMap_from_buffers(keys, vals, 2.0)
         self.assertEqual(len(m), len(keys))
         for x,y in zip(keys, vals):
@@ -107,8 +107,8 @@
             import numpy as np
         except:
             return # well what should I do?
-        keys=np.array([1,2,3, 42], dtype=np.object)
-        vals=np.array([4,5,6], dtype=np.object)
+        keys=np.array([1,2,3, 42], dtype=object)
+        vals=np.array([4,5,6], dtype=object)
         m=PyObjectMap_from_buffers(keys, vals, 2.0)
         self.assertEqual(len(m), len(vals))
         for x,y in zip(keys, vals):
--- a/tests/unit_tests/test_cykhash_memory.py
+++ b/tests/unit_tests/test_cykhash_memory.py
@@ -46,7 +46,7 @@
         (cyk.Int32Set, np.int32),
         (cyk.Float64Set, np.float64),
         (cyk.Float32Set, np.float32),
-        (cyk.PyObjectSet, np.object),
+        (cyk.PyObjectSet, object),
     ],
 )
 def test_tracemalloc_works_sets(set_type, dtype):
@@ -71,7 +71,7 @@
         (cyk.Int32toInt32Map, np.int32),
         (cyk.Float64toFloat64Map, np.float64),
         (cyk.Float32toFloat32Map, np.float32),
-        (cyk.PyObjectMap, np.object),
+        (cyk.PyObjectMap, object),
     ],
 )
 def test_tracemalloc_works_maps(map_type, dtype):
--- a/tests/unit_tests/test_isin.py
+++ b/tests/unit_tests/test_isin.py
@@ -82,14 +82,14 @@
 class TestBufferPyObject(UnitTestMock): 
     def test_pyobject_isin(self):
         s=PyObjectSet_from([2,4,6])
-        a=np.array(range(0,7), dtype=np.object)
+        a=np.array(range(0,7), dtype=object)
         result=array.array('B', [False]*7)
         isin_pyobject(a,s,result)
         expected=array.array('B', [False, False, True, False, True, False, True])
         self.assertTrue(expected==result)
 
     def test_pyobject_from_buffer(self):
-        a=np.array([6,7,8], dtype=np.object)
+        a=np.array([6,7,8], dtype=object)
         s=PyObjectSet_from_buffer(a)
         self.assertEqual(len(s), len(a))
         for x in a:
@@ -97,7 +97,7 @@
 
     def test_isin_result_shorter(self):      
         s=PyObjectSet_from([2,4,6])
-        a=np.array(range(0,7), dtype=np.object)
+        a=np.array(range(0,7), dtype=object)
         result=array.array('B', [False]*6)
         with pytest.raises(ValueError) as context:
             isin_pyobject(a,s,result)
@@ -105,14 +105,14 @@
 
     def test_isin_result_longer(self):
         s=PyObjectSet_from([2,4,6])
-        a=np.array(range(0,7), dtype=np.object)
+        a=np.array(range(0,7), dtype=object)
         result=array.array('B', [False]*8)
         with pytest.raises(ValueError) as context:
             isin_pyobject(a,s,result)
         self.assertEqual("Different sizes for query(7) and result(8)", context.value.args[0])
 
     def test_isin_db_none(self):
-        a=np.array(range(0,7), dtype=np.object)
+        a=np.array(range(0,7), dtype=object)
         result=array.array('B', [True]*7)
         isin_pyobject(a,None,result)
         expected=array.array('B', [False, False, False, False, False, False, False])
--- a/tests/unit_tests/test_map_to.py
+++ b/tests/unit_tests/test_map_to.py
@@ -120,44 +120,44 @@
 
 class TestMapToPyObject(UnitTestMock): 
     def test_None_map(self):
-        objs=np.array([]).astype(np.object)
+        objs=np.array([]).astype(object)
         with pytest.raises(TypeError) as context:
            PyObjectMap_to(None,objs,objs)
         self.assertTrue("'NoneType' is not a map" in context.value.args[0])
 
     def test_different_lengths(self):
         N = 1000
-        keys=np.arange(N).astype(np.object)
+        keys=np.arange(N).astype(object)
         mymap = PyObjectMap_from_buffers(keys, keys)
-        results=np.zeros(N+1).astype(np.object)
+        results=np.zeros(N+1).astype(object)
         with pytest.raises(ValueError) as context:
             PyObjectMap_to(mymap, keys, results)
         self.assertTrue("Different lengths" in context.value.args[0])
 
     def test_map_to_simple(self):
         N = 1000
-        keys=np.arange(N).astype(np.object)
-        vals=np.array(range(0,2*N,2)).astype(np.object)
+        keys=np.arange(N).astype(object)
+        vals=np.array(range(0,2*N,2)).astype(object)
         mymap = PyObjectMap_from_buffers(keys, vals)
         result = np.zeros_like(vals)
         self.assertEqual(PyObjectMap_to(mymap, keys, result), N)
         self.assertTrue(np.array_equal(vals,result))
 
     def test_map_with_stop(self):
-        keys=np.arange(3).astype(np.object)
-        vals=np.array([5,6,7]).astype(np.object)
+        keys=np.arange(3).astype(object)
+        vals=np.array([5,6,7]).astype(object)
         mymap = PyObjectMap_from_buffers(keys, vals)
-        query = np.array([2,55,1]).astype(np.object)
+        query = np.array([2,55,1]).astype(object)
         result = np.zeros_like(query)
         self.assertEqual(PyObjectMap_to(mymap, query, result), 1)
         self.assertEqual(result[0], vals[-1])
 
     def test_map_no_stop_float(self):
-        keys=np.arange(3).astype(np.object)
-        vals=np.array([5,6,7]).astype(np.object)
+        keys=np.arange(3).astype(object)
+        vals=np.array([5,6,7]).astype(object)
         mymap = PyObjectMap_from_buffers(keys, vals)
-        query = np.array([2,55,1,66,0]).astype(np.object)
+        query = np.array([2,55,1,66,0]).astype(object)
         result = np.zeros_like(query)
-        expected = np.array([7,42,6,42,5]).astype(np.object)
+        expected = np.array([7,42,6,42,5]).astype(object)
         self.assertEqual(PyObjectMap_to(mymap, query, result, False, 42), 3)
         self.assertTrue(np.array_equal(expected, result))
--- a/tests/unit_tests/test_none.py
+++ b/tests/unit_tests/test_none.py
@@ -93,7 +93,7 @@
 class TestNonePyObject(UnitTestMock): 
     def test_none_yes(self):
         s=PyObjectSet_from([2,4,666])
-        a=np.array([1,3,333]*6, dtype=np.object)
+        a=np.array([1,3,333]*6, dtype=object)
         result=none_pyobject(a,s)
         self.assertEqual(result, True)
 
@@ -105,7 +105,7 @@
 
     def test_none_last_no(self):
         s=PyObjectSet_from([2,4,666])
-        a=np.array([1,3,333]*6+[2], dtype=np.object)
+        a=np.array([1,3,333]*6+[2], dtype=object)
         result=none_pyobject(a,s)
         self.assertEqual(result, False)
 
@@ -117,7 +117,7 @@
 
     def test_none_empty(self):
         s=PyObjectSet_from([])
-        a=np.array([], dtype=np.object)
+        a=np.array([], dtype=object)
         result=none_pyobject(a,s)
         self.assertEqual(result, True)
 
@@ -129,7 +129,7 @@
 
     def test_none_empty_set(self):
         s=PyObjectSet_from([])
-        a=np.array([1], dtype=np.object)
+        a=np.array([1], dtype=object)
         result=none_pyobject(a,s)
         self.assertEqual(result, True)
 
@@ -151,7 +151,7 @@
         self.assertEqual(none_pyobject(None,s), True)
 
     def test_dbnone(self):
-        a=np.array([1], dtype=np.object)
+        a=np.array([1], dtype=object)
         self.assertEqual(none_pyobject(a,None), True)
 
     def test_dbnone_from_iter(self):
--- a/README.md
+++ b/README.md
@@ -40,7 +40,7 @@
     >>> import numpy as np 
     >>> a = np.arange(42, dtype=np.int64)
     >>> b = np.arange(84, dtype=np.int64)
-    >>> result = np.empty(b.size, dtype=np.bool)
+    >>> result = np.empty(b.size, dtype=bool)
 
     # actually usage
     >>> from cykhash import Int64Set_from_buffer, isin_int64
@@ -208,7 +208,7 @@
     >>> lookup = Int64Set_from_buffer(a)
 
     >>> b = np.arange(84, dtype=np.int64)
-    >>> result = np.empty(b.size, dtype=np.bool)
+    >>> result = np.empty(b.size, dtype=bool)
 
     >>> isin_int64(b, lookup, result)    # running time O(b.size)
     >>> assert np.sum(result.astype(np.int)) == 42
--- a/tests/unit_tests/test_documentation_examples.py
+++ b/tests/unit_tests/test_documentation_examples.py
@@ -28,10 +28,10 @@
         lookup = Int64Set_from_buffer(a)
 
         b = np.arange(84, dtype=np.int64)
-        result = np.empty(b.size, dtype=np.bool)
+        result = np.empty(b.size, dtype=bool)
 
         isin_int64(b, lookup, result)
-        assert np.sum(result.astype(np.int))==42
+        assert np.sum(result.astype(np.int64))==42
 
         self.assertTrue(True)
 
@@ -83,7 +83,7 @@
         import numpy as np 
         a = np.arange(42, dtype=np.int64)
         b = np.arange(84, dtype=np.int64)
-        result = np.empty(b.size, dtype=np.bool)
+        result = np.empty(b.size, dtype=bool)
 
         # actually usage
         from cykhash import Int64Set_from_buffer, isin_int64
