Skip to content

Commit

Permalink
Change classmethod args from self to cls
Browse files Browse the repository at this point in the history
  • Loading branch information
mliu49 committed Dec 6, 2019
1 parent a5c6aa0 commit e94b327
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 22 deletions.
14 changes: 7 additions & 7 deletions rmgpy/data/thermoTest.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,19 +82,19 @@ class TestThermoDatabase(unittest.TestCase):
"""

@classmethod
def setUpClass(self):
def setUpClass(cls):
"""A function that is run ONCE before all unit tests in this class."""
global database
self.database = database.thermo
cls.database = database.thermo

self.databaseWithoutLibraries = ThermoDatabase()
self.databaseWithoutLibraries.load(os.path.join(settings['database.directory'], 'thermo'), libraries=[])
cls.databaseWithoutLibraries = ThermoDatabase()
cls.databaseWithoutLibraries.load(os.path.join(settings['database.directory'], 'thermo'), libraries=[])

# Set up ML estimator
models_path = os.path.join(settings['database.directory'], 'thermo', 'ml', 'main')
hf298_path = os.path.join(models_path, 'hf298')
s298_cp_path = os.path.join(models_path, 's298_cp')
self.ml_estimator = MLEstimator(hf298_path, s298_cp_path)
cls.ml_estimator = MLEstimator(hf298_path, s298_cp_path)

def test_pickle(self):
"""
Expand Down Expand Up @@ -1640,10 +1640,10 @@ class TestThermoCentralDatabaseInterface(unittest.TestCase):
"""

@classmethod
def setUpClass(self):
def setUpClass(cls):
"""A function that is run ONCE before all unit tests in this class."""
global database
self.database = database.thermo
cls.database = database.thermo

def connect_to_test_central_database(self):
host, port, username, password = get_testing_tcd_authentication_info()
Expand Down
10 changes: 5 additions & 5 deletions rmgpy/data/transportTest.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,13 +126,13 @@ class TestTransportDatabase(unittest.TestCase):
"""

@classmethod
def setUpClass(self):
def setUpClass(cls):
"""A function that is run ONCE before all unit tests in this class."""
self.database = TransportDatabase()
self.database.load(os.path.join(settings['database.directory'], 'transport'),
['GRI-Mech', 'PrimaryTransportLibrary'])
cls.database = TransportDatabase()
cls.database.load(os.path.join(settings['database.directory'], 'transport'),
['GRI-Mech', 'PrimaryTransportLibrary'])

self.speciesList = [
cls.speciesList = [
Species().from_smiles('C'),
Species().from_smiles('CCCC'),
Species().from_smiles('O'),
Expand Down
20 changes: 10 additions & 10 deletions rmgpy/rmg/rmgTest.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,30 +47,30 @@
class TestRMGWorkFlow(unittest.TestCase):

@classmethod
def setUpClass(self):
def setUpClass(cls):
"""
A method that is run before all unit tests in this class.
"""
# set-up RMG object
self.rmg = RMG()
self.rmg.reaction_model = CoreEdgeReactionModel()
cls.rmg = RMG()
cls.rmg.reaction_model = CoreEdgeReactionModel()

# load kinetic database and forbidden structures
self.rmg.database = RMGDatabase()
cls.rmg.database = RMGDatabase()
path = os.path.join(settings['test_data.directory'], 'testing_database')

# kinetics family Disproportionation loading
self.rmg.database.load_kinetics(os.path.join(path, 'kinetics'),
kinetics_families=['H_Abstraction', 'R_Addition_MultipleBond'],
reaction_libraries=[])
cls.rmg.database.load_kinetics(os.path.join(path, 'kinetics'),
kinetics_families=['H_Abstraction', 'R_Addition_MultipleBond'],
reaction_libraries=[])

# load empty forbidden structures
for family in self.rmg.database.kinetics.families.values():
for family in cls.rmg.database.kinetics.families.values():
family.forbidden = ForbiddenStructures()
self.rmg.database.forbidden_structures = ForbiddenStructures()
cls.rmg.database.forbidden_structures = ForbiddenStructures()

@classmethod
def tearDownClass(self):
def tearDownClass(cls):
"""
Reset the loaded database
"""
Expand Down

0 comments on commit e94b327

Please sign in to comment.