Skip to content

Commit

Permalink
fix sapt test class errors
Browse files Browse the repository at this point in the history
  • Loading branch information
ALescoulie committed Jun 13, 2024
1 parent 58bd0af commit c17bb05
Showing 1 changed file with 11 additions and 17 deletions.
28 changes: 11 additions & 17 deletions mdsapt/tests/test_sapt.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,32 +9,26 @@
from ..config import Config, load_from_yaml_file
from ..sapt import TrajectorySAPT, DockingSAPT

traj_settings = load_from_yaml_file(
os.path.join(os.getcwd(), 'mdsapt', 'tests', 'testing_resources', 'test_input.yaml'))

dock_settings = load_from_yaml_file(
os.path.join(os.getcwd(), 'mdsapt', 'tests', 'testing_resources', 'docking_in.yaml'))

unv = traj_settings.analysis.create_universe()
elements = guess_types(unv.atoms.names)
unv.add_TopologyAttr('elements', elements)

class TestSAPT:
"""
Test object for SAPT analysis
"""
traj_settings: Config
dock_settings: Config
unv: MDAnalysis.Universe

def setup(self) -> None:
"""
Sets up system and config for other tests
"""
self.traj_settings = load_from_yaml_file(
os.path.join(os.getcwd(), 'mdsapt', 'tests', 'testing_resources', 'test_input.yaml'))
self.dock_settings = load_from_yaml_file(
os.path.join(os.getcwd(), 'mdsapt', 'tests', 'testing_resources', 'docking_in.yaml'))
self.unv = self.traj_settings.analysis.create_universe()
elements = guess_types(self.unv.atoms.names)
self.unv.add_TopologyAttr('elements', elements)

def test_run_traj_sapt(self) -> None:
"""
Test running trajectory SAPT
"""
sapt12 = TrajectorySAPT(self.traj_settings)
sapt12 = TrajectorySAPT(traj_settings)
sapt12.run(1, 2)
cols_act = sapt12.results.columns
cols_exp = ['residues', 'time', 'total', 'electrostatic',
Expand All @@ -47,7 +41,7 @@ def test_run_dock_sapt(self) -> None:
"""
Test running docking SAPT
"""
docking = DockingSAPT(self.dock_settings)
docking = DockingSAPT(dock_settings)
docking.run()
cols_act = docking.results.columns
cols_exp = ['structure', 'pair', 'total', 'electrostatic',
Expand Down

0 comments on commit c17bb05

Please sign in to comment.