← mined_baseline

fastapi_12935

failed NO_PATCH NO_PATCH UNSUBMITTED empty_patch(None) · None tool calls · 0 s · fastapi/fastapi

Task input

(not found in data/tasks.jsonl)

Tool calls (0)

#ToolArgumentsResult
No trace captured.

Test output

show
......s....s....s..F
=================================== FAILURES ===================================
___________________________ test_decimal_encoder_nan ___________________________

    @needs_pydanticv2
    def test_decimal_encoder_nan():
        data = {"value": Decimal("NaN")}
>       assert isnan(jsonable_encoder(data)["value"])
                     ^^^^^^^^^^^^^^^^^^^^^^

tests/test_jsonable_encoder.py:313: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
fastapi/encoders.py:298: in jsonable_encoder
    encoded_value = jsonable_encoder(
fastapi/encoders.py:327: in jsonable_encoder
    return ENCODERS_BY_TYPE[type(obj)](obj)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

dec_value = Decimal('NaN')

    def decimal_encoder(dec_value: Decimal) -> Union[int, float]:
        """
        Encodes a Decimal as int of there's no exponent, otherwise float
    
        This is useful when we use ConstrainedDecimal to represent Numeric(x,0)
        where a integer (but not int typed) is used. Encoding this as a float
        results in failed round-tripping between encode and parse.
        Our Id type is a prime example of this.
    
        >>> decimal_encoder(Decimal("1.0"))
        1.0
    
        >>> decimal_encoder(Decimal("1"))
        1
        """
>       if dec_value.as_tuple().exponent >= 0:  # type: ignore[operator]
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
E       TypeError: '>=' not supported between instances of 'str' and 'int'

fastapi/encoders.py:54: TypeError
!!!!!!!!!!!!!!!!!!!!!!!!!! stopping after 1 failures !!!!!!!!!!!!!!!!!!!!!!!!!!!
1 failed, 16 passed, 3 skipped in 0.44s