from AvizoTest import AvizoTest from _hx_core import HxObjectFactory, HxProject, HxPaths class TestHxProject(AvizoTest): def test_doc(self): self.assert_class_has_docstrings( HxProject ) def test_all(self): proj = HxProject() ortho = HxObjectFactory().create('HxOrthoSlice') ortho_name = "SomeUndefinedName" # test the add/get method. proj.add(ortho) ortho.name = ortho_name ortho2 = proj.get(ortho_name) self.assertTrue(ortho.is_same_object(ortho2)) del ortho2 # test remove method. proj.remove(ortho) self.assertRaises(KeyError, proj.get, ortho_name) # test the create() method. ortho = proj.create('HxOrthoSlice') ortho.name = "SomeUniqueName" self.assertTrue(proj.get(ortho.name).is_same_object(ortho)) proj.remove(ortho) # test the load() method. motor = proj.load(HxPaths().tutorials_dir + '/chocolate-bar.am') motor.name = "SomeUniqueName2" self.assertTrue(proj.get(motor.name).is_same_object(motor)) proj.remove(motor)