Exemplo 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",
    }
Exemplo n.º 2
0
def _read_dhall_file(filename):
    with open(filename, "r") as f:
        ctn = f.read()
        vars = dhall.loads(ctn)
    return vars
Exemplo n.º 3
0
def test_list_mixed_sign_integers(lst):
    with pytest.raises(TypeError):
        assert dhall.loads(dhall.dumps(lst)) == lst
Exemplo n.º 4
0
def test_empty_list_in_list_of_lists(xs):
    with pytest.raises(TypeError):
        assert dhall.loads(dhall.dumps(xs)) == xs
Exemplo n.º 5
0
def test_none(xs):
    assert dhall.loads(dhall.dumps(xs)) != xs
    assert dhall.loads(dhall.dumps(xs)) == {}
Exemplo n.º 6
0
def test_list_text(lst):
    assert dhall.loads(dhall.dumps(lst)) == lst
Exemplo n.º 7
0
def test_list_floats(lst):
    assert dhall.loads(dhall.dumps(lst)) == pytest.approx(lst)
Exemplo n.º 8
0
def test_list_naturals(lst):
    assert dhall.loads(dhall.dumps(lst)) == lst
Exemplo n.º 9
0
def test_bool(xs):
    assert dhall.loads(dhall.dumps(xs)) == xs
Exemplo n.º 10
0
def test_text(xs):
    assert dhall.loads(dhall.dumps(xs)) == xs
Exemplo n.º 11
0
def test_floats(xs):
    assert dhall.loads(dhall.dumps(xs)) == pytest.approx(xs)  # fails when abs=0.05