MCPcopy
hub / github.com/pydantic/pydantic / get_decimal_pattern

Function get_decimal_pattern

tests/test_json_schema.py:7075–7080  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

7073
7074@pytest.fixture
7075def get_decimal_pattern():
7076 def pattern(max_digits=None, decimal_places=None) -> str:
7077 filed = TypeAdapter(Annotated[Decimal, Field(max_digits=max_digits, decimal_places=decimal_places)])
7078 return filed.json_schema()['anyOf'][1]['pattern']
7079
7080 return pattern
7081
7082
7083@pytest.mark.parametrize('valid_decimal', ['0.1', '0000.1', '11.1', '001.1', '11111111.1', '0.100000', '0.01', '0.11'])

Calls

no outgoing calls

Tested by

no test coverage detected