Esempio n. 1
0
def test_list():
    x = Variable()
    y = Variable()
    assert [
        {
            "group_id": 590,
            "name": "alice"
        },
        {
            "group_id": 590,
            "name": "bob"
        },
        {
            "group_id": 999,
            "name": "charlie"
        },
    ] == [
        {
            "group_id": x,
            "name": "alice"
        },
        {
            "group_id": x,
            "name": "bob"
        },
        {
            "group_id": y,
            "name": "charlie"
        },
    ]
    assert x != y
Esempio n. 2
0
def test_2_different_variables():
    x = Variable()
    y = Variable()
    assert 1 == x
    assert 2 == y
    assert x < y
    assert y > x
Esempio n. 3
0
def test_assign_to_another_variable():
    x = Variable()
    y = Variable()
    assert x == y
    assert "XXX" == x
    assert "'XXX'" == repr(x)
    assert "'XXX'" == repr(y)
    assert "XXX" == y
Esempio n. 4
0
def test_dict():
    x = Variable()
    y = Variable()
    assert {1: "XXX", 2: "XXX", 3: "YYY"} == {1: x, 2: x, 3: y}
    assert x != y
Esempio n. 5
0
def test_int():
    x = Variable()
    assert 1.1 == x
    assert 1 == int(x)
Esempio n. 6
0
def test_round():
    x = Variable()
    assert 1.1 == x
    assert 1 == round(x, 0)
Esempio n. 7
0
def test_lte():
    x = Variable()
    assert 3 == x
    assert 2 <= x
Esempio n. 8
0
def test_right_hand_side():
    x = Variable()
    assert "?" == repr(x)
    assert "XXX" == x
    assert "'XXX'" == repr(x)
Esempio n. 9
0
def test_gte():
    x = Variable()
    assert 1 == x
    assert 2 >= x
Esempio n. 10
0
def test_only_one_value():
    x = Variable()
    assert "XXX" == x
    assert "YYY" != x
Esempio n. 11
0
def test_2_variables():
    x = Variable()
    y = Variable()
    assert {1: "XXX", 2: "XXX"} == {1: x, 2: y}
    assert x == y
Esempio n. 12
0
def test_left_hand_side():
    x = Variable()
    assert "?" == repr(x)
    assert x == "XXX"
    assert "'XXX'" == repr(x)