def test_resource_to_yaml(tmpdir): # Write target = os.path.join(tmpdir, "resource.yaml") resource = Resource("data/resource.json") resource.to_yaml(target) # Read with open(target, encoding="utf-8") as file: assert resource == yaml.safe_load(file)
def test_to_yaml_allow_unicode_issue_844(): resource = Resource("data/issue-844.csv", encoding="utf-8") resource.infer() text = resource.to_yaml() assert "età" in text
def test_sql_parser_describe_to_yaml_issue_821(database_url): dialect = SqlDialect(table="table") resource = Resource(database_url, dialect=dialect) resource.infer() assert resource.to_yaml()
def test_to_yaml_with_resource_data_is_not_a_list_issue_693(): data = lambda: [["id", "name"], [1, "english"], [2, "german"]] resource = Resource(data=data) text = resource.to_yaml() assert text == "{}\n"