Coverage for tests/test_default.py: 100%

32 statements  

« prev     ^ index     » next       coverage.py v7.11.0, created at 2025-10-27 00:03 +0000

1from sqlmodel.default import Default 1klmnopqrst

2 

3 

4def test_default_bool() -> None: 1klmnopqrst

5 dt1 = Default(True) 1abcdefghij

6 dt2 = Default(1) 1abcdefghij

7 dt3 = Default("foo") 1abcdefghij

8 dt4 = Default(["foo"]) 1abcdefghij

9 df1 = Default(False) 1abcdefghij

10 df2 = Default(0) 1abcdefghij

11 df3 = Default("") 1abcdefghij

12 df4: list = Default([]) 1abcdefghij

13 df5 = Default(None) 1abcdefghij

14 

15 assert not not dt1 1abcdefghij

16 assert not not dt2 1abcdefghij

17 assert not not dt3 1abcdefghij

18 assert not not dt4 1abcdefghij

19 assert not df1 1abcdefghij

20 assert not df2 1abcdefghij

21 assert not df3 1abcdefghij

22 assert not df4 1abcdefghij

23 assert not df5 1abcdefghij

24 

25 

26def test_equality() -> None: 1klmnopqrst

27 value1 = Default("foo") 1uvwxyzABCD

28 value2 = Default("foo") 1uvwxyzABCD

29 

30 assert value1 == value2 1uvwxyzABCD

31 

32 

33def test_not_equality() -> None: 1klmnopqrst

34 value1 = Default("foo") 1EFGHIJKLMN

35 value2 = Default("bar") 1EFGHIJKLMN

36 

37 assert not (value1 == value2) 1EFGHIJKLMN

38 

39 

40def test_not_equality_other() -> None: 1klmnopqrst

41 value1 = Default("foo") 1OPQRSTUVWX

42 value2 = "foo" 1OPQRSTUVWX

43 

44 assert not (value1 == value2) 1OPQRSTUVWX