def test_numpy_encoder_fail(): if not hasattr(numpy, "float128"): pytest.skip("numpy on exit" "this platform has no float128") test_number = numpy.float128 with pytest.raises(TypeError): ne = NumpyEncoder() ne.default(test_number)
def test_numpy_encoder(): test_number = numpy.int64(42) ne = NumpyEncoder() defaulted_val = ne.default(test_number) assert defaulted_val == 42