Coverage for tests / test_default.py: 100%
32 statements
« prev ^ index » next coverage.py v7.13.0, created at 2026-06-10 09:40 +0000
« prev ^ index » next coverage.py v7.13.0, created at 2026-06-10 09:40 +0000
1from sqlmodel.default import Default 1ijklmnop
4def test_default_bool() -> None: 1ijklmnop
5 dt1 = Default(True) 1abcdefgh
6 dt2 = Default(1) 1abcdefgh
7 dt3 = Default("foo") 1abcdefgh
8 dt4 = Default(["foo"]) 1abcdefgh
9 df1 = Default(False) 1abcdefgh
10 df2 = Default(0) 1abcdefgh
11 df3 = Default("") 1abcdefgh
12 df4: list = Default([]) 1abcdefgh
13 df5 = Default(None) 1abcdefgh
15 assert not not dt1 1abcdefgh
16 assert not not dt2 1abcdefgh
17 assert not not dt3 1abcdefgh
18 assert not not dt4 1abcdefgh
19 assert not df1 1abcdefgh
20 assert not df2 1abcdefgh
21 assert not df3 1abcdefgh
22 assert not df4 1abcdefgh
23 assert not df5 1abcdefgh
26def test_equality() -> None: 1ijklmnop
27 value1 = Default("foo") 1qrstuvwx
28 value2 = Default("foo") 1qrstuvwx
30 assert value1 == value2 1qrstuvwx
33def test_not_equality() -> None: 1ijklmnop
34 value1 = Default("foo") 1yzABCDEF
35 value2 = Default("bar") 1yzABCDEF
37 assert not (value1 == value2) 1yzABCDEF
40def test_not_equality_other() -> None: 1ijklmnop
41 value1 = Default("foo") 1GHIJKLMN
42 value2 = "foo" 1GHIJKLMN
44 assert not (value1 == value2) 1GHIJKLMN