Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions meta_tests/test_reporting.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
from array_api_tests.dtype_helpers import EqualityMapping
import reporting


class MLXDtype:
def __eq__(self, other):
if other is None:
raise TypeError("MLX dtype equality does not support None")
return self is other


def test_to_json_serializable_none_does_not_compare_to_dtypes(monkeypatch):
dtype = MLXDtype()
monkeypatch.setattr(reporting, "dtype_to_name", EqualityMapping([(dtype, "float16")]))

assert reporting.to_json_serializable(None) is None
2 changes: 1 addition & 1 deletion reporting.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
raise ImportError("pytest-json-report is required to run the array API tests")

def to_json_serializable(o):
if o in dtype_to_name:
if o is not None and o in dtype_to_name:
return dtype_to_name[o]
if isinstance(o, (BuiltinFunctionType, FunctionType, type)):
return o.__name__
Expand Down
Loading