Skip to content

Commit

Permalink
Test adding file to existing System
Browse files Browse the repository at this point in the history
  • Loading branch information
benmwebb committed Oct 4, 2024
1 parent bcacd14 commit 3661dba
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions test/test_reader.py
Original file line number Diff line number Diff line change
Expand Up @@ -1240,6 +1240,27 @@ def test_chem_comp_handler(self):
self.assertIsNone(d2.details)
self.assertIsNone(d2.software)

def test_add_to_system(self):
"""Test adding new mmCIF input to existing System"""
s = modelcif.System()
e = modelcif.Entity('AHC')
e._id = '42'
s.entities.append(e)
fh = StringIO("""
loop_
_struct_asym.id
_struct_asym.entity_id
_struct_asym.details
A 42 foo
B 99 bar
""")
s2, = modelcif.reader.read(fh, add_to_system=s)
self.assertIs(s2, s)
self.assertEqual(len(s.asym_units), 2)
# asym A should point to existing entity
self.assertEqual(s.asym_units[0].id, 'A')
self.assertIs(s.asym_units[0].entity, e)


if __name__ == '__main__':
unittest.main()

0 comments on commit 3661dba

Please sign in to comment.