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