(cpp_name, np_dtype)
| 52 | |
| 53 | @pytest.mark.parametrize(("cpp_name", "np_dtype"), CPP_NAME_NP_DTYPE_TABLE) |
| 54 | def test_format_descriptor_format_buffer_info_equiv(cpp_name, np_dtype): |
| 55 | if np_dtype is None: |
| 56 | pytest.skip( |
| 57 | f"cpp_name=`{cpp_name}`: `long double` and `double` have same size." |
| 58 | ) |
| 59 | if isinstance(np_dtype, str): |
| 60 | pytest.skip(f"np.{np_dtype} does not exist.") |
| 61 | np_array = np.array([], dtype=np_dtype) |
| 62 | for other_cpp_name, expected_format in CPP_NAME_FORMAT_TABLE: |
| 63 | format, np_array_is_matching = m.format_descriptor_format_buffer_info_equiv( |
| 64 | other_cpp_name, np_array |
| 65 | ) |
| 66 | assert format == expected_format |
| 67 | if other_cpp_name == cpp_name: |
| 68 | assert np_array_is_matching |
| 69 | else: |
| 70 | assert not np_array_is_matching |
| 71 | |
| 72 | |
| 73 | def test_from_python(): |
nothing calls this directly
no test coverage detected