Skip to content

Commit

Permalink
Update tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Bryan Bartley committed Oct 14, 2023
1 parent 190c6c3 commit 9bd4921
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 11 deletions.
8 changes: 4 additions & 4 deletions test/test_collection.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,14 @@ def test_member_property(self):
sbol3.set_namespace('https://github.com/synbiodex/pysbol3')
self.assertTrue(hasattr(sbol3, 'SBOL_MEMBER'))
collection = sbol3.Collection('collection1')
self.assertIn(sbol3.SBOL_MEMBER, collection._properties)
self.assertIn(sbol3.SBOL_MEMBER, collection._referenced_objects)
self.assertNotIn(sbol3.SBOL_ORIENTATION, collection._properties)
uris = ['https://github.com/synbiodex/pysbol3/thing1',
'https://github.com/synbiodex/pysbol3/thing2']
collection.members = uris
self.assertIn(sbol3.SBOL_MEMBER, collection._properties)
self.assertNotIn(sbol3.SBOL_ORIENTATION, collection._properties)
self.assertEqual(uris, collection.members)
self.assertIn(sbol3.SBOL_MEMBER, collection._referenced_objects)
self.assertNotIn(sbol3.SBOL_ORIENTATION, collection._referenced_objects)
self.assertListEqual(uris, [m.identity for m in collection.members])

# Namespace testing
def test_namespace_deduced(self):
Expand Down
9 changes: 5 additions & 4 deletions test/test_component.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,8 @@ def test_cloning_with_references(self):
c2 = c1.clone(new_identity)
self.assertEqual(posixpath.join(sbol3.get_namespace(), new_identity),
c2.identity)
self.assertListEqual(list(c1.sequences), list(c2.sequences))
self.assertListEqual([s.identity for s in c1.sequences],
[s.identity for s in c2.sequences])

def test_cloning_with_children(self):
# This test does not use `sbol3.set_namespace` as the other
Expand Down Expand Up @@ -129,7 +130,7 @@ def test_cloning_with_children(self):
self.assertIsInstance(es2, sbol3.EntireSequence)
self.assertNotEqual(es1.identity, es2.identity)
self.assertTrue(es2.identity.startswith(c2.identity))
self.assertEqual(es1.sequence, es2.sequence)
self.assertEqual(es1.sequence.identity, es2.sequence.identity)
self.assertIsNone(es2.document)

def test_cloning_references(self):
Expand Down Expand Up @@ -159,15 +160,15 @@ def test_cloning_references(self):
self.assertIsInstance(s_clone, sbol3.ComponentReference)
self.assertTrue(s_clone.identity.startswith(toggle_clone.identity))
self.assertNotEqual(s.identity, s_clone.identity)
self.assertEqual(s.refers_to, s_clone.refers_to)
self.assertEqual(s.refers_to.identity, s_clone.refers_to.identity)
o = c.object.lookup()
self.assertIsInstance(o, sbol3.ComponentReference)
self.assertTrue(o.identity.startswith(toggle.identity))
o_clone = c_clone.object.lookup()
self.assertIsInstance(o_clone, sbol3.ComponentReference)
self.assertTrue(o_clone.identity.startswith(toggle_clone.identity))
self.assertNotEqual(o.identity, o_clone.identity)
self.assertEqual(o.refers_to, o_clone.refers_to)
self.assertEqual(o.refers_to.identity, o_clone.refers_to.identity)

def test_measures_initial_value(self):
# See https://github.com/SynBioDex/pySBOL3/issues/301
Expand Down
2 changes: 1 addition & 1 deletion test/test_implementation.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ def test_read_from_file(self):
self.assertIsInstance(implementation, sbol3.Implementation)
tetr_uri = 'https://sbolstandard.org/examples/TetR_protein'
built = tetr_uri
self.assertCountEqual(built, implementation.built)
self.assertCountEqual(built, implementation.built.identity)


if __name__ == '__main__':
Expand Down
4 changes: 2 additions & 2 deletions test/test_om_unit.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ def test_create(self):
punit = sbol3.PrefixedUnit(display_id, symbol, label, unit, prefix)
self.assertIsNotNone(punit)
self.assertIsInstance(punit, sbol3.PrefixedUnit)
self.assertCountEqual(prefix, punit.prefix)
self.assertCountEqual(prefix, punit.prefix.identity)
self.assertEqual(unit, punit.unit)
self.assertEqual(symbol, punit.symbol)
self.assertEqual(label, punit.label)
Expand All @@ -92,7 +92,7 @@ def test_read_from_file(self):
punit = doc.find(uri)
self.assertIsNotNone(punit)
self.assertIsInstance(punit, sbol3.PrefixedUnit)
self.assertCountEqual('https://sbolstandard.org/examples/milli', punit.prefix)
self.assertCountEqual('https://sbolstandard.org/examples/milli', punit.prefix.identity)
self.assertEqual('https://sbolstandard.org/examples/mole', punit.unit)
self.assertEqual('millimole', punit.label)
self.assertEqual('millimole', punit.name)
Expand Down

0 comments on commit 9bd4921

Please sign in to comment.