diff --git a/tests/test_data/test_sqlite.py b/tests/test_data/test_sqlite.py index cb7c738ea..8206ccd2c 100644 --- a/tests/test_data/test_sqlite.py +++ b/tests/test_data/test_sqlite.py @@ -69,14 +69,7 @@ def test_sqlite_store(self): q = session.query(endpoint.module.Person) all_objs = q.all() self.assertEqual(2, len(all_objs)) - for p in all_objs: - print(p) - for rel in p.has_familial_relationships: - print(rel) - print(rel.type) q = session.query(endpoint.module.FamilialRelationship) - for r in q.all(): - print(r) session.close() # step 4: test loading from SQLStore # 4a: first test load_all, diff to original data should be empty @@ -120,7 +113,6 @@ def test_mixin(self): b.add_class("my_abstract", slots=["my_abstract_slot"], abstract=True) b.add_class("my_class1", is_a="my_abstract", mixins=["my_mixin"]) b.add_class("my_class2", slots=["ref_to_c1"]) - # print(yaml_dumper.dumps(b.schema)) endpoint = SQLStore(b.schema, database_path=TMP_DB) endpoint.db_exists(force=True) mod = endpoint.compile_native() @@ -128,7 +120,6 @@ def test_mixin(self): i2 = mod.MyClass2(ref_to_c1=i1) endpoint.dump(i2) i2_recap = endpoint.load(target_class=mod.MyClass2) - # print(yaml_dumper.dumps(i2_recap)) diff = compare_objs(i2, i2_recap) self.assertEqual(diff, "") diff --git a/tests/test_data/test_sqlite_pydantic.py b/tests/test_data/test_sqlite_pydantic.py index 88adce904..0fbe9003c 100644 --- a/tests/test_data/test_sqlite_pydantic.py +++ b/tests/test_data/test_sqlite_pydantic.py @@ -71,14 +71,7 @@ def test_sqlite_store(self): q = session.query(endpoint.module.Person) all_objs = q.all() self.assertEqual(2, len(all_objs)) - for p in all_objs: - print(p) - for rel in p.has_familial_relationships: - print(rel) - print(rel.type) q = session.query(endpoint.module.FamilialRelationship) - for r in q.all(): - print(r) # step 4: test loading from SQLStore # 4a: first test load_all, diff to original data should be empty [returned_container] = endpoint.load_all(target_class=Container) diff --git a/tests/test_enhancements/test_enumeration.py b/tests/test_enhancements/test_enumeration.py index d877c4dfb..a79f8a028 100644 --- a/tests/test_enhancements/test_enumeration.py +++ b/tests/test_enhancements/test_enumeration.py @@ -213,7 +213,6 @@ def test_notebook_model_2(self): "Something", [module.UnusualEnumPatterns.M, module.UnusualEnumPatterns["% ! -- whoo"]], ) - print(str(t)) def test_notebook_model_3(self): file = "notebook_model_3" diff --git a/tests/test_generators/test_contextgen.py b/tests/test_generators/test_contextgen.py index 9022a300f..069251a9e 100644 --- a/tests/test_generators/test_contextgen.py +++ b/tests/test_generators/test_contextgen.py @@ -26,7 +26,6 @@ def test_context(self): json_dumper.dump(element=inst, to_file=DATA_JSON) with open(CONTEXT_OUT, "w") as stream: stream.write(ContextGenerator(SCHEMA).serialize()) - print(rdf_dumper.dumps(inst, CONTEXT_OUT)) if __name__ == "__main__": diff --git a/tests/test_generators/test_owlgen.py b/tests/test_generators/test_owlgen.py index b9c2de411..3aebe2533 100644 --- a/tests/test_generators/test_owlgen.py +++ b/tests/test_generators/test_owlgen.py @@ -46,7 +46,6 @@ def test_owlgen(self): self.assertGreater(len(owl_classes), 10) for c in owl_classes: types = list(g.objects(c, RDF.type)) - # print(f'Class={c} {types}') self.assertCountEqual(types, [OWL.Class]) assert KS.MedicalEvent in owl_classes # test that enums are treated as classes @@ -55,13 +54,11 @@ def test_owlgen(self): assert len(owl_object_properties) > 10 for p in owl_object_properties: types = list(g.objects(p, RDF.type)) - # print(f'Class={c} {types}') self.assertCountEqual(types, [OWL.ObjectProperty]) owl_datatype_properties = list(g.subjects(RDF.type, OWL.DatatypeProperty)) assert len(owl_datatype_properties) > 10 for p in owl_datatype_properties: types = list(g.objects(p, RDF.type)) - # print(f'Class={c} {types}') self.assertCountEqual(types, [OWL.DatatypeProperty]) # check that definitions are present, and use the default profile self.assertIn( @@ -123,8 +120,6 @@ def test_definition_uris(self): URIRef('http://www.w3.org/2004/02/skos/core#exactMatch'), URIRef('http://schema.org/Person')) ] - #for t in triples: - # print(t) for t in expected: self.assertIn(t, triples) diff --git a/tests/test_generators/test_pydanticgen.py b/tests/test_generators/test_pydanticgen.py index 3c2b3496b..2d4e04098 100644 --- a/tests/test_generators/test_pydanticgen.py +++ b/tests/test_generators/test_pydanticgen.py @@ -49,16 +49,13 @@ def test_dynamic(): # NOTE: generated pydantic doesn't yet do validation e1 = EmploymentEvent(is_current=True) p1 = Person(id="x", has_employment_history=[e1]) - print(p1) assert p1.id == "x" assert p1.name is None json = {"id": "P1", "has_employment_history": [{"is_current": True}]} p2 = Person(**json) - print(p2) p2 = Person(**dataset_dict["persons"][0]) print(dataset_dict) ds1 = Dataset(**dataset_dict) - print(ds1) assert len(ds1.persons) == 2 test_dynamic() @@ -66,7 +63,6 @@ def test_dynamic(): def test_compile_pydantic(self): """Generate and compile pydantic classes""" gen = PydanticGenerator(SCHEMA, package=PACKAGE) - print(gen.allow_extra) code = gen.serialize() mod = compile_python(code, PACKAGE) p = mod.Person(id="P:1") diff --git a/tests/test_generators/test_pythongen.py b/tests/test_generators/test_pythongen.py index c69f9b8b3..d027d93b4 100644 --- a/tests/test_generators/test_pythongen.py +++ b/tests/test_generators/test_pythongen.py @@ -57,7 +57,6 @@ def test_pythongen(self): # however, inline in a non-list context does not p2dict = {"id": "P:2", "has_birth_event": {"started_at_time": "1981-01-01"}} p2 = json_loader.loads(p2dict, kitchen_module.Person) - print(p2) self.assertEqual( "Person(id='P:1', name=None, has_employment_history=[EmploymentEvent(started_at_time=None, ended_at_time=None, is_current=None, metadata=None, employed_at='ROR:1', type=None)], has_familial_relationships=[], has_medical_history=[], age_in_years=None, addresses=[], has_birth_event=None, species_name=None, stomach_count=None, is_living=None, aliases=[])", str(p), @@ -71,7 +70,6 @@ def test_pythongen(self): diagnosis = kitchen_module.DiagnosisConcept(id="CODE:D0001", name="headache") event = kitchen_module.MedicalEvent(in_location="GEO:1234", diagnosis=diagnosis) - print(str(event)) self.assertEqual( "MedicalEvent(started_at_time=None, ended_at_time=None, is_current=None, metadata=None, in_location='GEO:1234', diagnosis=DiagnosisConcept(id='CODE:D0001', name='headache', in_code_system=None), procedure=None)", str(event), diff --git a/tests/test_generators/test_rdfgen.py b/tests/test_generators/test_rdfgen.py index 86e827003..14c96f3b7 100644 --- a/tests/test_generators/test_rdfgen.py +++ b/tests/test_generators/test_rdfgen.py @@ -42,7 +42,6 @@ def test_rdf_type_in_jsonld(self): graph = Graph() graph.parse(data=JSONLD, format="json-ld", prefix=True) ttl_str = graph.serialize(format='turtle').decode() - print(ttl_str) graph.parse(data=ttl_str, format="turtle") diff --git a/tests/test_generators/test_shexgen.py b/tests/test_generators/test_shexgen.py index 4f6979787..a7f49b1c5 100644 --- a/tests/test_generators/test_shexgen.py +++ b/tests/test_generators/test_shexgen.py @@ -45,10 +45,8 @@ def test_shex(self): ) return raise e - # print(g) nodes = set() for s, p, o in g.triples((None, None, None)): - # print(f'{s} {p} {o}') nodes.add(s) for node in nodes: r = evaluate(g, shexstr, focus=node) diff --git a/tests/test_generators/test_sqlalchemygen.py b/tests/test_generators/test_sqlalchemygen.py index 83ddaf5e5..4a35679b8 100644 --- a/tests/test_generators/test_sqlalchemygen.py +++ b/tests/test_generators/test_sqlalchemygen.py @@ -139,7 +139,6 @@ def test_sqla_declarative_on_metamodel(self): """ sv = package_schemaview("linkml_runtime.linkml_model.meta") gen = SQLAlchemyGenerator(sv.schema) - print(f"SQLAGEN: ****") code = gen.generate_sqla(template=TemplateEnum.DECLARATIVE) assert "class ClassDefinition(" in code assert "class Annotation(" in code @@ -211,8 +210,6 @@ def test_sqla_imperative_dataclasses_exec(self): session.add(p1) q = session.query(mod.Person).where(mod.Person.name == p1.name) persons = q.all() - # for person in persons: - # print(f'Person={person}') assert len(persons) == 1 assert p1 in persons p1 = persons[0] @@ -235,8 +232,6 @@ def test_sqla_imperative_dataclasses_exec(self): session.commit() q = session.query(mod.Person).where(mod.Person.id == p2.id) persons = q.all() - # for person in persons: - # print(f'Person={person}') assert len(persons) == 1 p2_recap = persons[0] p2mh = p2_recap.has_medical_history @@ -285,8 +280,6 @@ def test_sqla_imperative_pydantic_exec(self): q = session.query(mod.Person).where(mod.Person.name == p1.name) # q = session.query(mod.Person) persons = q.all() - for person in persons: - print(f"Person={person}") self.assertEqual(1, len(persons)) assert p1 in persons p1 = persons[0] @@ -302,8 +295,6 @@ def test_sqla_imperative_pydantic_exec(self): q = session.query(mod.Person).where(mod.Person.id == p2.id) persons = q.all() assert len(persons) == 1 - # for person in persons: - # print(f'Person={person.has_medical_history}') p2_recap = persons[0] p2mh = p2_recap.has_medical_history assert p2mh[0].duration == e1.duration @@ -361,7 +352,6 @@ def test_sqla_declarative_exec(self): session.add(mod.Person(id="P2", aliases=["Fred"], has_news_events=[news_event])) # session.add(mod.Person(id='P3', has_familial_relationships=[{"related_to": "P4"}])) session.commit() - # print(f'QUERYING:: {mod.NewsEvent} // {type(mod.NewsEvent)}') q = session.query(mod.NewsEvent) all_news = q.all() # ensure news object is shared between persons @@ -371,7 +361,6 @@ def test_sqla_declarative_exec(self): for person in persons: assert isinstance(person, mod.NamedThing) logging.info(f"Person={person}") - # print(f' Person.address={person.current_address}') for a in person.aliases: logging.info(f" ALIAS={a}") for e in person.has_medical_history: diff --git a/tests/test_generators/test_sqlddlgen.py b/tests/test_generators/test_sqlddlgen.py index 7fe9e87a5..2115b4a52 100644 --- a/tests/test_generators/test_sqlddlgen.py +++ b/tests/test_generators/test_sqlddlgen.py @@ -90,9 +90,6 @@ def test_sqlddl(self): gen = SQLDDLGenerator(SCHEMA, mergeimports=True, rename_foreign_keys=True) ddl = gen.serialize() with open(SQLDDLLOG, "w") as log: - # with open(DDL_PATH, 'w') as stream: - # stream.write(ddl) - # print(ddl) try: os.remove(DB) except OSError: @@ -116,11 +113,9 @@ def test_sqlddl(self): log.write(f"{cur.fetchall()}\n") con.commit() con.close() - # print(gen.to_sqla_python()) # output = StringIO() # with redirect_stdout(output): # gen.write_sqla_python_imperative('output.kitchen_sink') - # print(output.getvalue()) # with open(SQLA_CODE, 'w') as stream: # stream.write(output.getvalue()) kitchen_module = create_and_compile_sqla_bindings(gen, SQLA_CODE) @@ -134,8 +129,6 @@ def test_sqlddl(self): kitchen_module.Person.name == NAME ) log.write(f"Q={q}\n") - # for row in q.all(): - # print(f'Row={row}') agent = kitchen_module.Agent(id="Agent03") log.write(f"Agent={agent}\n") activity = kitchen_module.Activity(id="Act01", was_associated_with=agent) @@ -181,8 +174,6 @@ def test_sqlddl(self): log.write(f" Address={a}\n") # if a.city == CITY: # is_found_address = True - # for alias in p.aliases: - # print(f' AKA={a}') # assert is_found_address session.commit() diff --git a/tests/test_generators/test_sqltablegen.py b/tests/test_generators/test_sqltablegen.py index 691d5b937..a145fa397 100644 --- a/tests/test_generators/test_sqltablegen.py +++ b/tests/test_generators/test_sqltablegen.py @@ -41,7 +41,6 @@ def test_inject_primary_key(self): b.add_defaults() gen = SQLTableGenerator(b.schema) ddl = gen.generate_ddl() - # print(ddl) assert "PRIMARY KEY (id)" in ddl assert "full_name TEXT" in ddl assert 'CREATE TABLE "dummy class"' in ddl @@ -56,7 +55,6 @@ def test_no_injection(self): b.add_defaults() gen = SQLTableGenerator(b.schema, use_foreign_keys=False) ddl = gen.generate_ddl() - # print(ddl) assert "PRIMARY KEY (id)" not in ddl assert "full_name TEXT" in ddl assert 'CREATE TABLE "dummy class"' in ddl @@ -80,7 +78,7 @@ def test_dialect(self): for dialect in ["postgresql", "sqlite", "mysql"]: gen = SQLTableGenerator(b.schema, dialect=dialect) ddl = gen.generate_ddl() - # print(f"DIALECT: {dialect}\n SQL:\n{ddl}") + if dialect == "postgresql": assert "id SERIAL" in ddl assert "COMMENT ON TABLE" in ddl @@ -218,7 +216,6 @@ def test_sqlddl_basic(self): with open(SQLDDLLOG, "w") as log: # with open(DDL_PATH, 'w') as stream: # stream.write(ddl) - # print(ddl) try: os.remove(DB) except OSError: diff --git a/tests/test_generators/test_sqltransform.py b/tests/test_generators/test_sqltransform.py index 89be5c35b..8bc6f1d78 100644 --- a/tests/test_generators/test_sqltransform.py +++ b/tests/test_generators/test_sqltransform.py @@ -44,7 +44,6 @@ def test_inject_primary_key(self): b.add_class(DUMMY_CLASS, slots) results = self._translate(b) rel_schema = self._translate(b).schema - # print(yaml_dumper.dumps(rel_schema)) self.assertCountEqual( slots + ["id"], list(rel_schema.classes[DUMMY_CLASS].attributes.keys()) ) @@ -111,7 +110,6 @@ def test_no_inject_primary_key(self): b.add_class(DUMMY_CLASS, slots).set_slot("name", identifier=True) results = self._translate(b) rel_schema = self._translate(b).schema - # print(yaml_dumper.dumps(rel_schema)) self.assertCountEqual( slots, list(rel_schema.classes[DUMMY_CLASS].attributes.keys()) ) @@ -132,7 +130,6 @@ def test_multivalued_literal(self): ) results = self._translate(b) rel_schema = self._translate(b).schema - # print(yaml_dumper.dumps(rel_schema)) rsv = SchemaView(rel_schema) c = rsv.get_class("c") assert c @@ -157,7 +154,6 @@ def test_inject_foreign_key(self): results = self._translate(b) rel_schema = self._translate(b).schema rsv = SchemaView(rel_schema) - # print(yaml_dumper.dumps(rel_schema)) c = rsv.get_class("c") d = rsv.get_class("d") self.assertCountEqual( @@ -186,7 +182,6 @@ def test_inject_backref_foreign_key(self): results = self._translate(b) rel_schema = self._translate(b).schema rsv = SchemaView(rel_schema) - # print(yaml_dumper.dumps(rel_schema)) c = rsv.get_class("c") d = rsv.get_class("d") self.assertCountEqual( @@ -223,7 +218,6 @@ def test_inject_many_to_many(self): results = self._translate(b) rel_schema = self._translate(b).schema rsv = SchemaView(rel_schema) - # print(yaml_dumper.dumps(rel_schema)) c = rsv.get_class("c") d = rsv.get_class("d") c_has_d = rsv.get_class("c_has_d") @@ -252,11 +246,9 @@ def test_inject_many_to_many_with_inheritance(self): "c1", is_a="c", slot_usage={"has_ds": SlotDefinition("has_ds", range="d1")} ) b.add_class("d1", is_a="d") - # print(yaml_dumper.dumps(b.schema)) results = self._translate(b) rel_schema = self._translate(b).schema rsv = SchemaView(rel_schema) - # print(yaml_dumper.dumps(rel_schema)) c = rsv.get_class("c") d = rsv.get_class("d") c1 = rsv.get_class("c1") @@ -294,7 +286,6 @@ def test_no_foreign_keys(self): result = sqltr.transform() rel_schema = result.schema rsv = SchemaView(rel_schema) - print(yaml_dumper.dumps(rel_schema)) assert "c_has_d" not in rsv.all_classes() c1 = rsv.get_class("c1") self.assertCountEqual(c1.attributes.keys(), ["name", "description", "has_ds"]) @@ -318,7 +309,6 @@ def test_aliases(self): results = self._translate(b) rel_schema = self._translate(b).schema rsv = SchemaView(rel_schema) - # print(yaml_dumper.dumps(rel_schema)) c = rsv.get_class("c") d = rsv.get_class("d") c_has_d = rsv.get_class("c_has_d") @@ -339,7 +329,6 @@ def test_sqlt_on_metamodel(self): sqltr = RelationalModelTransformer(sv) result = sqltr.transform() rschema = result.schema - # print(rschema.imports) with open(META_OUT_PATH, "w") as stream: stream.write(yaml_dumper.dumps(rschema)) # test Annotation is handled correctly. This has a key annotation_tag with alias 'tag' @@ -393,7 +382,6 @@ def test_sqlt_complete_example(self): "MedicalEvent", ]: c = sv.get_class(relationship_class) - # print(f'RC: {relationship_class} // {c}') assert any( a for a in c.attributes.values() @@ -409,8 +397,6 @@ def test_sqlt_complete_example(self): for cn in ["Person", "Organization"]: c = sv.get_class(f"{cn}_has_news_event") - # print(list(c.attributes.keys())) - # print(list(c.attributes.values())) a1 = c.attributes["has_news_event_id"] self.assertEqual(a1.range, "NewsEvent") a2 = c.attributes[f"{cn}_id"] diff --git a/tests/test_issues/test_issue_675.py b/tests/test_issues/test_issue_675.py index cf9685d17..9df5e31f1 100644 --- a/tests/test_issues/test_issue_675.py +++ b/tests/test_issues/test_issue_675.py @@ -82,32 +82,31 @@ def test_ifabsent(self): See: https://github.com/linkml/linkml/issues/1333 """ - # print(PythonGenerator(model_txt).serialize()) m = compile_python(PythonGenerator(model_txt).serialize()) sample = m.HighClass() self.assertEqual(sample.bool_true_slot, True) self.assertEqual(sample.bool_false_slot, False) - print("class_curie_slot fails") + # TODO: class_curie_slot fails # self.assertEqual(sample.class_curie_slot, m.HighClass.class_class_curie) self.assertIsNone(sample.class_curie_slot) - print("class_uri_slot fails") + # TODO: class_uri_slot fails # self.assertEqual(sample.class_uri_slot, m.HighClass.class_class_uri) self.assertIsNone(sample.class_uri_slot) - print(m.HighClass.class_class_uri) - print("default_ns fails") + + # TODO: default_ns fails") # self.assertEqual(sample.default_ns_slot, 'ex') self.assertEqual(sample.default_ns_slot, None) - print("default_range fails") + # TODO: default_range fails # self.assertEqual(sample.default_range_slot, 'string') self.assertIsNone(sample.default_range_slot) - print("int(0) fails") + # TODO: int(0) fails self.assertEqual(sample.int_0_slot, 0) self.assertEqual(sample.int_42_slot, 42) self.assertEqual(sample.neg_int_slot, -117243) - print("slot_curie fails") + # TODO: slot_curie fails # self.assertEqual(sample.slot_curie_slot, m.slots.slot_curie_slot.curie) self.assertIsNone(sample.slot_curie_slot) - print("slot_uri fails") + # TODO: slot_uri fails # self.assertEqual(sample.slot_uri_slot, m.slots.slot_uri_slot.uri) self.assertIsNone(sample.slot_uri_slot) self.assertIsNone(sample.slot_curie_slot) @@ -121,31 +120,29 @@ def test_ifabsent_pydantic(self): See: https://github.com/linkml/linkml/issues/1334 """ - print(PydanticGenerator(model_txt).serialize()) m = compile_python(PydanticGenerator(model_txt).serialize()) sample = m.HighClass() self.assertEqual(sample.bool_true_slot, True) self.assertEqual(sample.bool_false_slot, False) - print("class_curie_slot fails") + # TODO: class_curie_slot fails # self.assertEqual(sample.class_curie_slot, m.HighClass.class_class_curie) self.assertIsNone(sample.class_curie_slot) - print("class_uri_slot fails") + # TODO: class_uri_slot fails # self.assertEqual(sample.class_uri_slot, m.HighClass.class_class_uri) self.assertIsNone(sample.class_uri_slot) - print(m.HighClass.class_class_uri) - print("default_ns fails") + # TODO: default_ns fails self.assertEqual(sample.default_ns_slot, 'ex') - print("default_range fails") + # TODO: default_range fails # self.assertEqual(sample.default_range_slot, 'string') self.assertIsNone(sample.default_range_slot) - print("int(0) fails") + # TODO: int(0) fails self.assertEqual(sample.int_0_slot, 0) self.assertEqual(sample.int_42_slot, 42) self.assertEqual(sample.neg_int_slot, -117243) - print("slot_curie fails") + # TODO: slot_curie fails # self.assertEqual(sample.slot_curie_slot, m.slots.slot_curie_slot.curie) self.assertIsNone(sample.slot_curie_slot) - print("slot_uri fails") + # TODO: slot_uri fails # self.assertEqual(sample.slot_uri_slot, m.slots.slot_uri_slot.uri) self.assertIsNone(sample.slot_uri_slot) self.assertIsNone(sample.slot_curie_slot) diff --git a/tests/test_issues/test_issue_756.py b/tests/test_issues/test_issue_756.py index 3dd902fd8..182bd6191 100644 --- a/tests/test_issues/test_issue_756.py +++ b/tests/test_issues/test_issue_756.py @@ -14,7 +14,6 @@ class MyTestCase(unittest.TestCase): def test_something(self): sv = SchemaView(SCHEMA) self.assertEqual(sv.schema.name, "test") # add assertion here - # print(sv.all_enums()) test_ae = yaml_dumper.dumps(sv.all_enums()) print(test_ae) diff --git a/tests/test_issues/test_linkml_issue_163.py b/tests/test_issues/test_linkml_issue_163.py index 76fa281bd..74c1051ee 100644 --- a/tests/test_issues/test_linkml_issue_163.py +++ b/tests/test_issues/test_linkml_issue_163.py @@ -55,8 +55,6 @@ def test_namespace(self): with open(outpath, "w") as stream: stream.write(jsonld_str) nsl = gen.namespaces - for k, v in nsl.items(): - print(f'{k}: "{v}"') # namespaces directly declared assert nsl["RO"] == "http://purl.obolibrary.org/obo/RO_" assert nsl["biolink"] == "https://w3id.org/biolink/vocab/" @@ -72,10 +70,8 @@ def test_namespace(self): assert nsl["owl"] == "http://www.w3.org/2002/07/owl#" im = gen.importmap - print(im) em = gen.emit_metadata - print(em) graph = Graph() graph.parse( @@ -113,8 +109,6 @@ def test_issue_mappings_namespace(self): ), g, ) - # for s,p,o in g.triples((None,None,None)): - # print(f'{s} {p} {o}') self.assertIn( (SNV, SKOS.exactMatch, URIRef("http://purl.obolibrary.org/obo/SO_0001483")), g, diff --git a/tests/test_issues/test_linkml_issue_270.py b/tests/test_issues/test_linkml_issue_270.py index 43297d73a..fa3f6b321 100644 --- a/tests/test_issues/test_linkml_issue_270.py +++ b/tests/test_issues/test_linkml_issue_270.py @@ -28,8 +28,6 @@ def test_metaslot_inheritance(self): infile = env.input_path(f"{name}.yaml") gen = YAMLGenerator(infile) schema = gen.schema - for sn, s in schema.slots.items(): - print(f"{sn} name={s.name} alias={s.alias} {s}") s = schema.slots["s1"] c2_s1 = schema.slots["C2_s1"] self.assertEqual(c2_s1.alias, s.name) @@ -44,7 +42,6 @@ def test_metaslot_inheritance(self): "slot_uri", ]: self.assertEqual(getattr(s, k), getattr(c2_s1, k)) - print(gen.serialize()) if __name__ == "__main__": diff --git a/tests/test_issues/test_linkml_issue_296.py b/tests/test_issues/test_linkml_issue_296.py index a33cb4514..ccdfa455f 100644 --- a/tests/test_issues/test_linkml_issue_296.py +++ b/tests/test_issues/test_linkml_issue_296.py @@ -41,17 +41,13 @@ class Issue296TestCase(TestEnvironmentTestCase): def test_any(self): py = PythonGenerator(schema).serialize() - # print(py) mod = compile_python(py) dict_obj = {"x": 1, "y": {"foo": "foo1", "bar": "bar1"}} x = mod.C(s="foo") - # print(x) self.assertEqual(x.s, "foo") x = mod.C(s=dict_obj) - # print(x) self.assertEqual(x.s, JsonObj(dict_obj)) x = mod.C(s=1) - # print(x) self.assertEqual(x.s, 1) with self.assertRaises(Exception): mod.C(t=dict_obj) diff --git a/tests/test_issues/test_linkml_issue_315.py b/tests/test_issues/test_linkml_issue_315.py index b137fa9dd..298886e26 100644 --- a/tests/test_issues/test_linkml_issue_315.py +++ b/tests/test_issues/test_linkml_issue_315.py @@ -21,12 +21,10 @@ def test_keyval(self): pstr = str(gen.serialize()) mod = compile_python(pstr) d1 = mod.Container(word_mappings={"hand": "manus"}) - print(d1) assert d1.word_mappings["hand"] == mod.WordMapping(src="hand", tgt="manus") obj = yaml_loader.load( env.input_path(f"{name}_data.yaml"), target_class=mod.Container ) - print(obj) assert obj.word_mappings["foot"] == mod.WordMapping(src="foot", tgt="pes") diff --git a/tests/test_issues/test_linkml_issue_384.py b/tests/test_issues/test_linkml_issue_384.py index 1d7ca2d05..255e277a6 100644 --- a/tests/test_issues/test_linkml_issue_384.py +++ b/tests/test_issues/test_linkml_issue_384.py @@ -41,9 +41,7 @@ def _test_other(self, name: str) -> None: ).serialize(), value_is_returned=True, ) - # print(f'Loading: {infile}') # rdfstr = RDFGenerator(infile, context=[METAMODEL_CONTEXT_URI]).serialize(context=[METAMODEL_CONTEXT_URI]) - # print(rdfstr) self.env.generate_single_file( f"{name}.ttl", lambda: RDFGenerator( diff --git a/tests/test_issues/test_linkml_issue_463.py b/tests/test_issues/test_linkml_issue_463.py index 147db1f64..13000eb00 100644 --- a/tests/test_issues/test_linkml_issue_463.py +++ b/tests/test_issues/test_linkml_issue_463.py @@ -27,7 +27,6 @@ def test_inlined(self): """Ensure that inlined lists without identifiers work""" gen = PythonGenerator(env.input_path("linkml_issue_463.yaml")) pystr = gen.serialize() - # print(pystr) with open(env.expected_path("linkml_issue_463.py"), "w") as stream: stream.write(pystr) module = compile_python(pystr) diff --git a/tests/test_issues/test_linkml_issue_547.py b/tests/test_issues/test_linkml_issue_547.py index e215a5113..756ce1434 100644 --- a/tests/test_issues/test_linkml_issue_547.py +++ b/tests/test_issues/test_linkml_issue_547.py @@ -69,7 +69,6 @@ def test_decimals(self): # Python initializers will convert from string to decimal try: py_obj = pymod.Person(**obj) - # print(f'PY={py_obj} // {type(py_obj.age)}') logging.info(f"PY={py_obj}") logging.info(f"AGE_PLUS_ONE={py_obj.age + 1}") assert (py_obj.age + 1) - 1 == py_obj.age @@ -77,7 +76,6 @@ def test_decimals(self): assert isinstance(py_obj.age, Decimal) # https://github.com/yaml/pyyaml/issues/255 # yaml_str = yaml_dumper.dumps(py_obj) - # print(yaml_str) # https://stackoverflow.com/questions/1960516/python-json-serialize-a-decimal-object # https://bugs.python.org/issue16535 json_str = json_dumper.dumps(py_obj) diff --git a/tests/test_issues/test_linkml_issue_571.py b/tests/test_issues/test_linkml_issue_571.py index e215a5113..756ce1434 100644 --- a/tests/test_issues/test_linkml_issue_571.py +++ b/tests/test_issues/test_linkml_issue_571.py @@ -69,7 +69,6 @@ def test_decimals(self): # Python initializers will convert from string to decimal try: py_obj = pymod.Person(**obj) - # print(f'PY={py_obj} // {type(py_obj.age)}') logging.info(f"PY={py_obj}") logging.info(f"AGE_PLUS_ONE={py_obj.age + 1}") assert (py_obj.age + 1) - 1 == py_obj.age @@ -77,7 +76,6 @@ def test_decimals(self): assert isinstance(py_obj.age, Decimal) # https://github.com/yaml/pyyaml/issues/255 # yaml_str = yaml_dumper.dumps(py_obj) - # print(yaml_str) # https://stackoverflow.com/questions/1960516/python-json-serialize-a-decimal-object # https://bugs.python.org/issue16535 json_str = json_dumper.dumps(py_obj) diff --git a/tests/test_issues/test_linkml_issue_723.py b/tests/test_issues/test_linkml_issue_723.py index a4927b0a3..3f4b5d35b 100644 --- a/tests/test_issues/test_linkml_issue_723.py +++ b/tests/test_issues/test_linkml_issue_723.py @@ -72,13 +72,11 @@ class Issue723ExportCase(TestEnvironmentTestCase): def setUp(self) -> None: gen = PythonGenerator(schema_str) output = gen.serialize() - # print(output) mod = compile_python(output) self.mod = mod self.schemaview = SchemaView(schema_str) gen = PydanticGenerator(schema_str) output = gen.serialize() - # print(output) self.pydantic_mod = compile_python(output) def test_plain_dataclasses(self): @@ -128,13 +126,11 @@ def test_initialized_enums(self): ) # Test behavior of dumpers pd = json_dumper.to_dict(p) - # print(pd) self.assertEqual(pd["status"], "ALIVE") self.assertCountEqual(pd["roles"], ["ANALYST", "INVESTIGATOR"]) p_json = json_dumper.dumps(p) p_roundtrip = json_loader.loads(p_json, target_class=mod.Person) self.assertEqual(p_roundtrip, p) - # print(yaml_dumper.dumps(p)) # Current behavior: when enums are created at time of initialization, # they are created as Enum instances, NOT permissible value instances self.assertEqual(p.status, mod.VitalStatus(mod.VitalStatus.ALIVE)) @@ -147,8 +143,6 @@ def test_initialized_enums(self): self.assertEqual(type(p.roles[0]), mod.Role) g = rdflib_dumper.as_rdf_graph(p, schemaview=self.schemaview) [subj] = list(g.subjects(RDF.type, EXAMPLE.Person)) - # for t in g.triples((None,None,None)): - # print(t) self.assertEqual(list(g.objects(subj, EXAMPLE.status)), [EXAMPLE.Alive]) self.assertCountEqual( list(g.objects(subj, EXAMPLE.roles)), @@ -175,7 +169,6 @@ def test_assigned_enum(self): p.status = mod.VitalStatus.ALIVE p.roles = [mod.Role.ANALYST, mod.Role.INVESTIGATOR] pd = json_dumper.to_dict(p) - print(pd) # we might expect this # self.assertEqual(pd['status'], 'ALIVE') self.assertCountEqual( @@ -185,16 +178,11 @@ def test_assigned_enum(self): # this does NOT roundtrip: # p_roundtrip = json_loader.loads(p_json, target_class=mod.Person) # self.assertEqual(p_roundtrip, p) - print(yaml_dumper.dumps(p)) self.assertEqual(p.status, mod.VitalStatus.ALIVE) self.assertCountEqual(p.roles, [mod.Role.INVESTIGATOR, mod.Role.ANALYST]) self.assertEqual(type(p.status), PermissibleValue) self.assertNotEqual(type(p.status), mod.VitalStatus) self.assertEqual(type(p.roles[0]), PermissibleValue) - # currently fails - # g = rdflib_dumper.as_rdf_graph(p, schemaview=self.schemaview) - # for t in g.triples((None,None,None)): - # print(t) def test_assigned_wrapped_enums(self): """ @@ -234,7 +222,6 @@ def test_assigned_wrapped_enums(self): self.assertEqual(p3, p) # Test behavior of dumpers pd = json_dumper.to_dict(p) - # print(pd) self.assertEqual(pd["status"], "ALIVE") self.assertCountEqual(pd["roles"], ["ANALYST", "INVESTIGATOR"]) p_json = json_dumper.dumps(p) @@ -250,8 +237,6 @@ def test_assigned_wrapped_enums(self): self.assertEqual(type(p.roles[0]), mod.Role) g = rdflib_dumper.as_rdf_graph(p, schemaview=self.schemaview) [subj] = list(g.subjects(RDF.type, EXAMPLE.Person)) - # for t in g.triples((None,None,None)): - # print(t) self.assertEqual(list(g.objects(subj, EXAMPLE.status)), [EXAMPLE.Alive]) self.assertCountEqual( list(g.objects(subj, EXAMPLE.roles)), @@ -261,7 +246,6 @@ def test_assigned_wrapped_enums(self): def test_pydantic(self): mod = self.pydantic_mod p = mod.Person(status="ALIVE", roles=["ANALYST", "INVESTIGATOR"]) - print(p) with self.assertRaises(ValueError) as e: p = mod.Person(status="FAKE") # with self.assertRaises(ValueError) as e: @@ -282,7 +266,6 @@ def test_pydantic(self): p.status = mod.VitalStatus(mod.VitalStatus.ALIVE) self.assertEqual(p.status, mod.VitalStatus.ALIVE) # TODO: not implemented? - # print(p.dict()) # not supported yet # pd = json_dumper.to_dict(p) diff --git a/tests/test_issues/test_linkml_issue_726.py b/tests/test_issues/test_linkml_issue_726.py index e6954c1a5..028bf3da4 100644 --- a/tests/test_issues/test_linkml_issue_726.py +++ b/tests/test_issues/test_linkml_issue_726.py @@ -57,7 +57,6 @@ class Issue726ConstCase(TestEnvironmentTestCase): def test_jsonschema(self): gen = JsonSchemaGenerator(schema_str) output = gen.serialize() - print(output) js = json.loads(output) top_props = js["properties"] s1C = top_props["s1"] diff --git a/tests/test_issues/test_linkml_issue_817.py b/tests/test_issues/test_linkml_issue_817.py index 5f3406a98..6e850d70e 100644 --- a/tests/test_issues/test_linkml_issue_817.py +++ b/tests/test_issues/test_linkml_issue_817.py @@ -27,17 +27,12 @@ def test_inline(self): pygen = PythonGenerator(infile) mod = pygen.compile_module() p = mod.Person(id="x", name="x", vital_status=mod.VitalStatusEnum("LIVING")) - # print(type(p.vital_status)) - # print(yaml_dumper.dumps(p)) c = mod.Container() c.persons_as_list = [p] # c.persons_as_dict = {p.id: p} self._roundtrip(c, mod.Container) - # print(yaml_dumper.dumps(c)) - # print(type(p.vital_status)) c = mod.Container(persons_as_list=[p], persons_as_dict=[p]) self.assertEqual(c.persons_as_dict[p.id].name, p.name) - # print(yaml_dumper.dumps(c)) c2 = self._roundtrip(c, mod.Container) self.assertEqual(c2.persons_as_dict[p.id].name, p.name) diff --git a/tests/test_rewrite_rules/test_rewrite_rules.py b/tests/test_rewrite_rules/test_rewrite_rules.py index bd9b128e4..6414ec497 100644 --- a/tests/test_rewrite_rules/test_rewrite_rules.py +++ b/tests/test_rewrite_rules/test_rewrite_rules.py @@ -9,7 +9,6 @@ if __name__ == "__main__": sys.path.append(os.path.join(os.path.dirname(__file__), "..", "..")) - print(sys.path) from tests import SKIP_REWRITE_RULES, SKIP_REWRITE_RULES_REASON @@ -105,17 +104,14 @@ class RewriteRuleTestCase(unittest.TestCase): @classmethod def setUpClass(cls): cls.tests = TestLists(cls.SERVER) - print(f"Server: {cls.SERVER}") cls.results = set() # from, to, format @classmethod def tearDownClass(cls): - print() for from_url, to_url, hdr in sorted(list(cls.results)): fmt = "" if hdr == "text/html" else f" ({hdr})" if DEFAULT_SERVER != W3ID_SERVER: from_url = from_url.replace(DEFAULT_SERVER, W3ID_SERVER) - print(f"{from_url}{fmt} - {to_url}") def record_results(self, from_url: str, accept_header, to_url: str) -> None: self.results.add((from_url, to_url, accept_header.split(",")[0])) diff --git a/tests/test_scripts/test_gen_jsonld.py b/tests/test_scripts/test_gen_jsonld.py index b3efda568..4ad86da6a 100644 --- a/tests/test_scripts/test_gen_jsonld.py +++ b/tests/test_scripts/test_gen_jsonld.py @@ -143,7 +143,6 @@ def test_meta_output(self): # Generate an image of the metamodel gen = ContextGenerator(env.meta_yaml, importmap=env.import_map) - print(f"P {env.meta_yaml}") base = gen.namespaces[gen.schema.default_prefix] if str(base)[-1] not in "/#": diff --git a/tests/test_utils/test_converter.py b/tests/test_utils/test_converter.py index 3b1d1cb8b..20026615b 100644 --- a/tests/test_utils/test_converter.py +++ b/tests/test_utils/test_converter.py @@ -22,7 +22,6 @@ def test_help(self): result = self.runner.invoke(cli, ["--help"]) out = result.stdout err = result.stderr - # print(err) self.assertIn("INPUT", out) # self.assertEqual(0, result.exit_code) diff --git a/tests/test_utils/test_generator.py b/tests/test_utils/test_generator.py index abeb3f71e..76ad070f8 100644 --- a/tests/test_utils/test_generator.py +++ b/tests/test_utils/test_generator.py @@ -73,7 +73,6 @@ def visit_schema(self, **kwargs) -> None: def end_schema(self, **kwargs) -> None: self.visited.append(f"end_schema: {self.schema.name}") - pprint(self.visited) def visit_class(self, cls: ClassDefinition) -> bool: self.visited.append(f"class: {cls.name}") diff --git a/tests/test_utils/test_load_raw_schema.py b/tests/test_utils/test_load_raw_schema.py index e67dba771..fcb770ca4 100644 --- a/tests/test_utils/test_load_raw_schema.py +++ b/tests/test_utils/test_load_raw_schema.py @@ -135,23 +135,19 @@ def test_representation_errors(self): fn = env.input_path("typeerror1.yaml") with self.assertRaises(ValueError) as e: SchemaLoader(fn) - print(str(e.exception)) # previously, this returned a value error. The new loader is robust enough that it no longer does fn = env.input_path("typeerror2.yaml") SchemaLoader(fn) # with self.assertRaises(ValueError) as e: # SchemaLoader(fn) - # print(str(e.exception)) fn = env.input_path("typeerror3.yaml") SchemaLoader(fn) # with self.assertRaises(ValueError) as e: # SchemaLoader(fn) - # print(str(e.exception)) fn = env.input_path("typeerror4.yaml") SchemaLoader(fn) # with self.assertRaises(ValueError) as e: # SchemaLoader(fn) - # print(str(e.exception)) if __name__ == "__main__": diff --git a/tests/test_utils/test_schema_builder.py b/tests/test_utils/test_schema_builder.py index ec1f2dd5b..034aacf7c 100644 --- a/tests/test_utils/test_schema_builder.py +++ b/tests/test_utils/test_schema_builder.py @@ -45,7 +45,6 @@ def test_build_schema(self): b.add_defaults() self.assertEqual(["linkml:types"], s.imports) d = b.as_dict() - print(yaml.dump(d)) def test_slot_overrides(self): """ diff --git a/tests/test_utils/test_schema_fixer.py b/tests/test_utils/test_schema_fixer.py index c49e0994f..5b6ad4e60 100644 --- a/tests/test_utils/test_schema_fixer.py +++ b/tests/test_utils/test_schema_fixer.py @@ -30,8 +30,6 @@ def test_add_titles(self): s = b.schema fixer = SchemaFixer() fixer.add_titles(s) - #print(fixer.history) - #print(yaml_dumper.dumps(s)) c = s.classes[MY_CLASS] e = s.enums[MY_ENUM] self.assertEqual(c.title, "my class") @@ -61,8 +59,6 @@ def test_attributes_to_slots(self): s = b.schema fixer = SchemaFixer() fixer.attributes_to_slots(s, remove_redundant_slot_usage=False) - #print(fixer.history) - #print(yaml_dumper.dumps(s)) c = s.classes[MY_CLASS] self.assertCountEqual([FULL_NAME, DESC], c.slots) self.assertEqual({}, c.attributes) @@ -78,7 +74,6 @@ def test_merge_slot_usage(self): fixer.merge_slot_usage( s, c, SlotDefinition(FULL_NAME, description="desc1", range="string") ) - #print(yaml_dumper.dumps(s)) su = c.slot_usage[FULL_NAME] self.assertEqual("desc1", su.description) self.assertEqual("string", su.range) @@ -93,7 +88,6 @@ def test_merge_slot_usage(self): range="string", ), ) - #print(yaml_dumper.dumps(s)) su = c.slot_usage[FULL_NAME] with self.assertRaises(ValueError): fixer.merge_slot_usage(s, c, SlotDefinition(FULL_NAME, description="desc2")) @@ -101,7 +95,6 @@ def test_merge_slot_usage(self): fixer.merge_slot_usage( s, c, SlotDefinition(FULL_NAME, description="desc2"), overwrite=True ) - #print(yaml_dumper.dumps(s)) su = c.slot_usage[FULL_NAME] self.assertEqual("desc2", su.description) @@ -164,8 +157,6 @@ def test_attributes_to_slots_remove_redundant(self): s = b.schema fixer = SchemaFixer() fixer.attributes_to_slots(s, remove_redundant_slot_usage=True) - #print(fixer.history) - #print(yaml_dumper.dumps(s)) c = s.classes[MY_CLASS] self.assertCountEqual([ID, FULL_NAME, DESC], c.slots) self.assertEqual({}, c.attributes) @@ -191,7 +182,6 @@ def test_fix_element_names(self): b.add_defaults() fixer = SchemaFixer() schema = b.schema - print(yaml_dumper.dumps(schema)) fixed_schema = fixer.fix_element_names(schema) for v in slots.values(): self.assertIn(v, fixed_schema.slots) diff --git a/tests/test_validation/test_jsonschemavalidation.py b/tests/test_validation/test_jsonschemavalidation.py index 6b2f9c80a..6377560cd 100644 --- a/tests/test_validation/test_jsonschemavalidation.py +++ b/tests/test_validation/test_jsonschemavalidation.py @@ -36,6 +36,5 @@ def test_jsonschema_validation(self): self.assertEqual(type(j), dict) self.assertGreater(len(j.keys()), 0) - if __name__ == "__main__": unittest.main() diff --git a/tests/test_validation/test_sparqlvalidation.py b/tests/test_validation/test_sparqlvalidation.py index 4da060354..162df0389 100644 --- a/tests/test_validation/test_sparqlvalidation.py +++ b/tests/test_validation/test_sparqlvalidation.py @@ -14,10 +14,7 @@ class SparqlValidatorTestCase(unittest.TestCase): @unittest.skip def test_sparql_validation(self): """Validate using in-memory sparql""" - print(f"TEST: Loading {SCHEMA}") sg = SparqlGenerator(SCHEMA) - print(sg.queries) - print(f"Making validator {SCHEMA}") sv = SparqlDataValidator() sv.load_schema(SCHEMA) results = sv.validate_file(DATA)