schrodinger.test.project_mock module¶
This module has classes that can be used to mock out project related functionality that cannot be accessed from outside of Maestro for unit tests.
An example of how to use would be to have a setUp function in a
unittest.TestCase
derived class that does the following:
class MyTestClass(unittest.TestCase):
- def setUp(self):
self.mock_mae = MagicMock() mymodule.maestro = self.mock_mae self.pt = MockProjectTable(‘project_sts.maegz’) self.mock_mae.project_table_get = MagicMock(return_value=self.pt)
Copyright Schrodinger, LLC. All rights reserved.
-
class
schrodinger.test.project_mock.
MockProjectRow
(eid, st)[source]¶ Bases:
object
Standin for the
schrodinger.project.ProjectRow
class for tests.-
__init__
(eid, st)[source]¶ - Parameters
st (
schrodinger.structure.Structure
) – Structure associated with this row
-
getStructure
(copy=True)[source]¶ Return the structure for this row.
- Parameters
copy (bool) – Whether the return value should be the structure object itself or a copy thereof
- Returns
The Structure for this row
- Return type
structure.Structure
-
-
class
schrodinger.test.project_mock.
MockProjectTable
(st_fname=None, sts=None)[source]¶ Bases:
object
Stands in for the
schrodinger.project.Project
class for the tests.-
__init__
(st_fname=None, sts=None)[source]¶ - Parameters
st_fname (str) – Name of structure file to load project row structures from.
sts (list of
structrue
) – Structures to load
-
getRow
(eid)[source]¶ Return the row at the specified eid index or None if not found.
- Parameters
eid (int) – ‘Entry ID’ index for the row to return
- Returns
The row of the specified enry if found or None if not
- Return type
FakeProjectRow
or None
-
includeRows
(entry_ids, exclude_others=True, autofit=True)[source]¶ Mock project row inclusion in the workspace. The arguments here are added to mimic project.Project.includeRows.
- Parameters
entry_ids (list[int]) – Entry IDs to include.
exclude_others (bool) – Whether to exclude previous included entries.
autofit (bool) – Used only to match API call for project.Project.includeRows, any value passed will be ignored as this relates to Maestro workspace.
-
property
included_rows
¶
-
property
selected_rows
¶
-
property
all_rows
¶
-