Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 41 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/de/docs/tutorial/extra-data-types.md

    * `bytes`:
        * Standard-Python-`bytes`.
        * In Requests und Responses werden sie als `str` behandelt.
        * Das generierte Schema wird anzeigen, dass es sich um einen `str` mit `binary` „Format“ handelt.
    * `Decimal`:
        * Standard-Python-`Decimal`.
        * In Requests und Responses wird es wie ein `float` behandelt.
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Sat Sep 20 15:10:09 UTC 2025
    - 3.2K bytes
    - Viewed (0)
  5. docs/ko/docs/tutorial/extra-data-types.md

            * 생성된 스키마는 (JSON 스키마의 `uniqueItems`를 이용해) `set`의 값이 고유함을 명시합니다.
    * `bytes`:
        * 표준 파이썬의 `bytes`.
        * 요청과 응답에서 `str`로 취급됩니다.
        * 생성된 스키마는 이것이 `binary` "형식"의 `str`임을 명시합니다.
    * `Decimal`:
        * 표준 파이썬의 `Decimal`.
        * 요청과 응답에서 `float`와 동일하게 다뤄집니다.
    * 여기에서 모든 유효한 pydantic 데이터 자료형을 확인할 수 있습니다: <a href="https://docs.pydantic.dev/latest/usage/types/types/" class="external-link" target="_blank">Pydantic 데이터 자료형</a>.
    
    ## 예시
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Mon Nov 18 02:25:44 UTC 2024
    - 2.9K bytes
    - Viewed (0)
  6. docs/uk/docs/tutorial/extra-data-types.md

    * `bytes`:
        * Стандартний Пайтонівський `bytes`.
        * У запитах і відповідях це буде оброблено як `str`.
        * Згенерована схема буде вказувати, що це `str` з "форматом" `binary`.
    * `Decimal`:
        * Стандартний Пайтонівський `Decimal`.
        * У запитах і відповідях це буде оброблено так само, як і `float`.
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Mon Nov 18 02:25:44 UTC 2024
    - 4.2K bytes
    - Viewed (0)
  7. docs/ru/docs/tutorial/extra-data-types.md

    * `bytes`:
        * Встроенный в Python `bytes`.
        * В запросах и ответах будет рассматриваться как `str`.
        * В сгенерированной схеме будет указано, что это `str` в формате `binary`.
    * `Decimal`:
        * Встроенный в Python `Decimal`.
        * В запросах и ответах обрабатывается так же, как и `float`.
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Tue Sep 30 11:24:39 UTC 2025
    - 4.4K bytes
    - Viewed (0)
  8. docs/en/docs/tutorial/extra-data-types.md

    * `bytes`:
        * Standard Python `bytes`.
        * In requests and responses will be treated as `str`.
        * The generated schema will specify that it's a `str` with `binary` "format".
    * `Decimal`:
        * Standard Python `Decimal`.
        * In requests and responses, handled the same as a `float`.
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Sun Aug 31 09:15:41 UTC 2025
    - 2.7K bytes
    - Viewed (0)
  9. 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)
  10. docs/pt/docs/tutorial/extra-data-types.md

    * `bytes`:
        * O `bytes` padrão do Python.
        * Em requisições e respostas será representado como uma `str`.
        * O esquema gerado vai especificar que é uma `str` com o "formato" `binary`.
    * `Decimal`:
        * O `Decimal` padrão do Python.
        * Em requisições e respostas será representado como um `float`.
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Wed Nov 12 16:23:57 UTC 2025
    - 3K bytes
    - Viewed (0)
Back to top