MCPcopy
hub / github.com/tortoise/tortoise-orm / test_default

Function test_default

tests/test_default.py:53–64  ·  view source on GitHub ↗

Test that default values are correctly applied when inserting via raw SQL.

(default_row)

Source from the content-addressed store, hash-verified

51
52@pytest.mark.asyncio
53async def test_default(default_row):
54 """Test that default values are correctly applied when inserting via raw SQL."""
55 default_model = await DefaultModel.first()
56 assert default_model.int_default == 1
57 assert default_model.float_default == 1.5
58 assert default_model.decimal_default == Decimal(1)
59 assert default_model.bool_default
60 assert default_model.char_default == "tortoise"
61 assert default_model.date_default == datetime.date(year=2020, month=5, day=21)
62 assert default_model.datetime_default == datetime.datetime(
63 year=2020, month=5, day=20, tzinfo=UTC
64 )

Callers

nothing calls this directly

Calls 1

firstMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…