Skip to content

Commit 030888d

Browse files
committed
[test/RDFWriter] Test RDF subclassing optional
1 parent d1385ea commit 030888d

1 file changed

Lines changed: 22 additions & 0 deletions

File tree

test/test_rdf_writer.py

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -288,3 +288,25 @@ def test_get_rdf_string(self):
288288

289289
with self.assertRaises(ValueError):
290290
rdf_writer.get_rdf_str("abc")
291+
292+
def test_rdf_subclassing_switch(self):
293+
"""
294+
Test the RDF section subclassing switch.
295+
"""
296+
# Section type term defined in odml/resources/section_subclasses.yaml that will
297+
# be converted to an RDF Section Subclass of Class "Cell".
298+
sub_class_term = "cell"
299+
300+
# Create minimal document
301+
doc = odml.Document()
302+
_ = odml.Section(name="test_subclassing", type=sub_class_term, parent=doc)
303+
304+
# Test default subclassing
305+
rdf_writer = RDFWriter([doc])
306+
result = rdf_writer.get_rdf_str()
307+
self.assertIn("odml:Cell", result)
308+
309+
# Test inactivation of subclassing feature
310+
rdf_writer = RDFWriter([doc], rdf_subclassing=False)
311+
result = rdf_writer.get_rdf_str()
312+
self.assertNotIn("odml:Cell", result)

0 commit comments

Comments
 (0)