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