コード例 #1
0
ファイル: test_resource.py プロジェクト: kant/frictionless-py
def test_resource_to_json(tmpdir):

    # Write
    target = os.path.join(tmpdir, "resource.json")
    resource = Resource("data/resource.json")
    resource.to_json(target)

    # Read
    with open(target, encoding="utf-8") as file:
        assert resource == json.load(file)
コード例 #2
0
def test_to_json_with_resource_data_is_not_a_list_issue_693():
    data = lambda: [["id", "name"], [1, "english"], [2, "german"]]
    resource = Resource(data=data)
    text = resource.to_json()
    assert text == "{}"