Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 7 of 7 for Decimal (0.03 sec)

  1. tests/test_multi_body_errors.py

    from decimal import Decimal
    
    from dirty_equals import IsOneOf
    from fastapi import FastAPI
    from fastapi.testclient import TestClient
    from inline_snapshot import snapshot
    from pydantic import BaseModel, condecimal
    
    app = FastAPI()
    
    
    class Item(BaseModel):
        name: str
        age: condecimal(gt=Decimal(0.0))  # type: ignore
    
    
    @app.post("/items/")
    def save_item_no_body(item: list[Item]):
        return {"item": item}
    
    
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Sat Dec 27 18:19:10 UTC 2025
    - 6.1K bytes
    - Viewed (0)
  2. tests/test_jsonable_encoder.py

    
    def test_decimal_encoder_float():
        data = {"value": Decimal(1.23)}
        assert jsonable_encoder(data) == {"value": 1.23}
    
    
    def test_decimal_encoder_int():
        data = {"value": Decimal(2)}
        assert jsonable_encoder(data) == {"value": 2}
    
    
    def test_decimal_encoder_nan():
        data = {"value": Decimal("NaN")}
        assert isnan(jsonable_encoder(data)["value"])
    
    
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Sat Dec 27 12:54:56 UTC 2025
    - 9.2K bytes
    - Viewed (0)
  3. fastapi/encoders.py

        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
    
        >>> decimal_encoder(Decimal("NaN"))
        nan
        """
        exponent = dec_value.as_tuple().exponent
        if isinstance(exponent, int) and exponent >= 0:
            return int(dec_value)
        else:
            return float(dec_value)
    
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Sat Dec 27 12:54:56 UTC 2025
    - 10.7K bytes
    - Viewed (0)
  4. docs/es/docs/tutorial/extra-data-types.md

    * `bytes`:
        * `bytes` estándar de Python.
        * En requests y responses se tratará como `str`.
        * El esquema generado especificará que es un `str` con "binary" como "format".
    * `Decimal`:
        * `Decimal` estándar de Python.
        * En requests y responses, manejado igual que un `float`.
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Tue Dec 16 16:33:45 UTC 2025
    - 2.9K bytes
    - Viewed (0)
  5. fastapi/param_functions.py

                """
            ),
        ] = _Unset,
        decimal_places: Annotated[
            Union[int, None],
            Doc(
                """
                Maximum number of decimal places allowed for numbers.
                """
            ),
        ] = _Unset,
        examples: Annotated[
            Optional[list[Any]],
            Doc(
                """
                Example values for this field.
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Sat Dec 27 12:54:56 UTC 2025
    - 63K bytes
    - Viewed (0)
  6. src/main/java/org/codelibs/fess/mylasta/direction/FessConfig.java

         * comment: Boost value for title field in queries.
         * @return The value of found property. (NotNull: if not found, exception but basically no way)
         * @throws NumberFormatException When the property is not decimal.
         */
        java.math.BigDecimal getQueryBoostTitleAsDecimal();
    
        /**
         * Get the value for the key 'query.boost.title.lang'. <br>
         * The value is, e.g. 1.0 <br>
    Registered: Sat Dec 20 09:19:18 UTC 2025
    - Last Modified: Sat Dec 13 02:21:17 UTC 2025
    - 525.7K bytes
    - Viewed (2)
  7. docs/en/docs/release-notes.md

    ### Fixes
    
    * 🐛 Avoid accessing non-existing "$ref" key for Pydantic v2 compat remapping. PR [#14361](https://github.com/fastapi/fastapi/pull/14361) by [@svlandeg](https://github.com/svlandeg).
    * 🐛 Fix `TypeError` when encoding a decimal with a `NaN` or `Infinity` value. PR [#12935](https://github.com/fastapi/fastapi/pull/12935) by [@kentwelcome](https://github.com/kentwelcome).
    
    ### Internal
    
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Sat Dec 27 19:06:15 UTC 2025
    - 586.7K bytes
    - Viewed (0)
Back to top