Example #1
0
 def test_isin_db_none(self):
     a = np.array(range(0, 7), dtype=np.object)
     result = array.array('B', [True] * 7)
     isin_pyobject(a, None, result)
     expected = array.array(
         'B', [False, False, False, False, False, False, False])
     self.assertTrue(expected == result)
Example #2
0
 def test_pyobject_isin(self):
     s = PyObjectSet_from([2, 4, 6])
     a = np.array(range(0, 7), dtype=np.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)
Example #3
0
 def test_isin_result_longer(self):
     s = PyObjectSet_from([2, 4, 6])
     a = np.array(range(0, 7), dtype=np.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])
Example #4
0
 def test_pyobject_isin(self):
     try:
         import numpy as np
     except:
         return  # well what should I do?
     s = PyObjectSet_from([2, 4, 6])
     a = np.array(range(0, 7), dtype=np.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)
Example #5
0
 def test_isin_nones(self):
     s = PyObjectSet_from([2, 4, 6])
     isin_pyobject(None, s, None)
     self.assertTrue(True)