def test_default_func_invalid_str(self):
        """
        dumps() default function errors on invalid str
        """
        ref = Custom()

        def default(obj):
            return "\ud800"

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

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