''' unit tests for pymol.exporting geometry formats ''' from pymol import cmd, testing def file_get_contents(filename, mode='r'): with open(filename, mode) as handle: return handle.read() class TestExportingGeom(testing.PyMOLTestCase): def testVRML(self): cmd.fragment('gly') for rep in ['spheres', 'sticks', 'surface']: cmd.show_as(rep) with testing.mktemp('.wrl') as filename: cmd.save(filename) contents = file_get_contents(filename) self.assertTrue(contents.startswith('#VRML V2')) @testing.requires_version('1.8') def testCOLLADA(self): cmd.fragment('gly') for rep in ['spheres', 'sticks', 'surface']: cmd.show_as(rep) with testing.mktemp('.dae') as filename: cmd.save(filename) contents = file_get_contents(filename) self.assertTrue(' 84)