def test_convert(self): """ Test the jsonld conversion function """ out_text = StringIO() with redirect_stdout(out_text): main( ["-id", indir, "-od", compdir, "-if", "ttl", "-of", "json-ld"]) self.assertEqual("""Total=3 Successful=3""", out_text.getvalue().strip())
def test_tutorial(self): # main(["-i", "../tutorial/demo1.ttl", "-o", "../tutorial/demo1.json"]) # main(["-i", "../tutorial/demo3.json", "-o", "../tutorial/demo3.ttl"]) # main(["-i", "../tutorial/demo3.json", "-o", "../tutorial/demo3.ttl"]) # main(["-i", "../tutorial/account-example.ttl", "-o", "../tutorial/account-example.json"]) # main(["-i", "../tutorial/mini.ttl", "-o", "../tutorial/mini.json"]) # main(["-i", "../tutorial/mini.ttl", "-o", "../tutorial/mini.xml"]) # main(["-i", "../tutorial/mini.ttl", "-o", "../tutorial/mini.ntriples"]) # main(["-i", "../tutorial/mini.ttl", "-o", "../tutorial/mini.trig"]) # main(["-i", "../tutorial/tweaked_patient_output.ttl", "-o", "../tutorial/tweaked_patient_output_pretty.ttl"]) # main(["-i", "../tutorial/patient_example_dicom.ttl", "-o", "../tutorial/patient_example_dicom_out.ttl"]) main(["-i", "r4_turtle/coding_1.n3", "-o", "r4_turtle/coding_1.ttl"])
def test_help(self): """ Test the help file """ help_file = os.path.join(cwd, indir, "rdfc_help") help_text = StringIO() with redirect_stdout(help_text): with self.assertRaises(HelpPrinted): main(["--help"]) if os.path.exists(help_file): with open(help_file) as f: expected = f.read() self.assertEqual(expected.strip(), help_text.getvalue().strip()) else: with open(help_file, 'w') as f: f.write(help_text.getvalue()) self.fail(f"{help_file} created - rerun test")
def to_ttl(self, fn: str) -> None: fb = fn.split('.', 1)[0] main(["-fp", "-i", f"r5_rdf/{fn}", "-o", f"r5_rdf/{fb}.ttl"])
import os from fhir_rdf_validator.convert_rdf import main cwd = os.path.dirname(__file__) main(["-id", cwd, "-od", cwd, "-if", "n3", "-of", "ttl"])
import os from fhir_rdf_validator.convert_rdf import main cwd = os.path.dirname(__file__) main(["-id", cwd, "-od", cwd, "-if", "n3", "-of", "json-ld"])