From e94b32755bc2da58330a2193f558a3ec869e3fab Mon Sep 17 00:00:00 2001 From: Max Liu Date: Wed, 4 Dec 2019 15:56:47 -0500 Subject: [PATCH] Change classmethod args from self to cls --- rmgpy/data/thermoTest.py | 14 +++++++------- rmgpy/data/transportTest.py | 10 +++++----- rmgpy/rmg/rmgTest.py | 20 ++++++++++---------- 3 files changed, 22 insertions(+), 22 deletions(-) diff --git a/rmgpy/data/thermoTest.py b/rmgpy/data/thermoTest.py index 3248443d265..1bd88a5ba79 100644 --- a/rmgpy/data/thermoTest.py +++ b/rmgpy/data/thermoTest.py @@ -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): """ @@ -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() diff --git a/rmgpy/data/transportTest.py b/rmgpy/data/transportTest.py index 4bbf5da4457..3547130499e 100644 --- a/rmgpy/data/transportTest.py +++ b/rmgpy/data/transportTest.py @@ -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'), diff --git a/rmgpy/rmg/rmgTest.py b/rmgpy/rmg/rmgTest.py index c7eac0f9538..f7f09ecf302 100644 --- a/rmgpy/rmg/rmgTest.py +++ b/rmgpy/rmg/rmgTest.py @@ -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 """