Esempio n. 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",
    }
Esempio n. 2
0
def test_list_mixed_sign_integers(lst):
    with pytest.raises(TypeError):
        assert dhall.loads(dhall.dumps(lst)) == lst
Esempio n. 3
0
def test_empty_list_in_list_of_lists(xs):
    with pytest.raises(TypeError):
        assert dhall.loads(dhall.dumps(xs)) == xs
Esempio n. 4
0
def test_none(xs):
    assert dhall.loads(dhall.dumps(xs)) != xs
    assert dhall.loads(dhall.dumps(xs)) == {}
Esempio n. 5
0
def test_list_text(lst):
    assert dhall.loads(dhall.dumps(lst)) == lst
Esempio n. 6
0
def test_list_floats(lst):
    assert dhall.loads(dhall.dumps(lst)) == pytest.approx(lst)
Esempio n. 7
0
def test_list_naturals(lst):
    assert dhall.loads(dhall.dumps(lst)) == lst
Esempio n. 8
0
def test_bool(xs):
    assert dhall.loads(dhall.dumps(xs)) == xs
Esempio n. 9
0
def test_text(xs):
    assert dhall.loads(dhall.dumps(xs)) == xs
Esempio n. 10
0
def test_floats(xs):
    assert dhall.loads(dhall.dumps(xs)) == pytest.approx(xs)  # fails when abs=0.05