|
16 | 16 | np.int_, np.uint, np.longlong, np.ulonglong,
|
17 | 17 | np.single, np.double, np.longdouble, np.csingle,
|
18 | 18 | np.cdouble, np.clongdouble]
|
| 19 | +all_numbers_dtypes = np.typecodes['AllInteger'] + np.typecodes['AllFloat'] +\ |
| 20 | + np.typecodes['Complex'] |
19 | 21 |
|
20 | 22 | floating_types = np.floating.__subclasses__()
|
21 | 23 | complex_floating_types = np.complexfloating.__subclasses__()
|
@@ -707,3 +709,13 @@ def test_shift_all_bits(self, type_code, op):
|
707 | 709 | shift_arr = np.array([shift]*32, dtype=dt)
|
708 | 710 | res_arr = op(val_arr, shift_arr)
|
709 | 711 | assert_equal(res_arr, res_scl)
|
| 712 | + |
| 713 | +class TestComparison: |
| 714 | + @pytest.mark.parametrize('type_code_rhs', all_numbers_dtypes) |
| 715 | + @pytest.mark.parametrize('type_code_lhs', all_numbers_dtypes) |
| 716 | + def test_numbers_compare(self, type_code_rhs, type_code_lhs): |
| 717 | + rand_num = np.random.randint(0, 127) |
| 718 | + a = np.dtype(type_code_rhs).type(rand_num) |
| 719 | + b = np.dtype(type_code_lhs).type(rand_num) |
| 720 | + |
| 721 | + assert_almost_equal(a, b) |
0 commit comments