def test_default_func_bytes(self):
        """
        dumps() default function errors on non-str
        """
        ref = Custom()

        def default(obj):
            return bytes(obj)

        with pytest.raises(orjson.JSONEncodeError):
            orjson.dumps(ref, default=default)

        ran = False
        try:
            orjson.dumps(ref, default=default)
        except Exception as err:
            assert isinstance(err, orjson.JSONEncodeError)
            assert str(err) == "Type is not JSON serializable: Custom"
            ran = True
        assert ran

        dumps() default function errors on non-str
        
test/test_default.py