Пример #1
0
def test_docs():
    assert (dhall.dumps({
        "keyA": 81,
        "keyB": True,
        "keyC": "value"
    }) == '{ keyA = 81, keyB = True, keyC = "value" }')
    assert dhall.loads("""{ keyA = 81, keyB = True, keyC = "value" }""") == {
        "keyA": 81,
        "keyB": True,
        "keyC": "value",
    }
Пример #2
0
def test_list_mixed_sign_integers(lst):
    with pytest.raises(TypeError):
        assert dhall.loads(dhall.dumps(lst)) == lst
Пример #3
0
def test_empty_list_in_list_of_lists(xs):
    with pytest.raises(TypeError):
        assert dhall.loads(dhall.dumps(xs)) == xs
Пример #4
0
def test_none(xs):
    assert dhall.loads(dhall.dumps(xs)) != xs
    assert dhall.loads(dhall.dumps(xs)) == {}
Пример #5
0
def test_list_text(lst):
    assert dhall.loads(dhall.dumps(lst)) == lst
Пример #6
0
def test_list_floats(lst):
    assert dhall.loads(dhall.dumps(lst)) == pytest.approx(lst)
Пример #7
0
def test_list_naturals(lst):
    assert dhall.loads(dhall.dumps(lst)) == lst
Пример #8
0
def test_bool(xs):
    assert dhall.loads(dhall.dumps(xs)) == xs
Пример #9
0
def test_text(xs):
    assert dhall.loads(dhall.dumps(xs)) == xs
Пример #10
0
def test_floats(xs):
    assert dhall.loads(dhall.dumps(xs)) == pytest.approx(xs)  # fails when abs=0.05