File: test_default.py

package info (click to toggle)
sqlmodel 0.0.24-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 9,128 kB
  • sloc: python: 34,496; javascript: 280; sh: 15; makefile: 7
file content (44 lines) | stat: -rw-r--r-- 842 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
from sqlmodel.default import Default


def test_default_bool() -> None:
    dt1 = Default(True)
    dt2 = Default(1)
    dt3 = Default("foo")
    dt4 = Default(["foo"])
    df1 = Default(False)
    df2 = Default(0)
    df3 = Default("")
    df4: list = Default([])
    df5 = Default(None)

    assert not not dt1
    assert not not dt2
    assert not not dt3
    assert not not dt4
    assert not df1
    assert not df2
    assert not df3
    assert not df4
    assert not df5


def test_equality() -> None:
    value1 = Default("foo")
    value2 = Default("foo")

    assert value1 == value2


def test_not_equality() -> None:
    value1 = Default("foo")
    value2 = Default("bar")

    assert not (value1 == value2)


def test_not_equality_other() -> None:
    value1 = Default("foo")
    value2 = "foo"

    assert not (value1 == value2)