def check_rdf_scan(expected_file, result_file, regen=False):
import json<EOL>result = load_and_clean_rdf(result_file)<EOL>if regen:<EOL><INDENT>expected = result<EOL>with codecs.open(expected_file, '<STR_LIT:w>', encoding='<STR_LIT:utf-8>') as o:<EOL><INDENT>json.dump(expected, o, indent=<NUM_LIT:2>)<EOL><DEDENT><DEDENT>else:<EOL><INDENT>with codecs.open(expected_file, '<STR_LIT:r>', encoding='<STR_LIT:utf-8>') as i:<EOL><INDENT>expected = sort_nested(json.load(i))<EOL><DEDENT><DEDENT>assert expected == result<EOL>
Check that expected and result_file are equal.
Both are paths to SPDX RDF XML files, UTF-8 encoded.