Skip to content

TST: Remove __init__ statements in testing #16238

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 4, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pandas/tests/indexes/test_multi.py
Original file line number Diff line number Diff line change
Expand Up @@ -486,7 +486,7 @@ def test_copy_names(self):

def test_names(self):

# names are assigned in __init__
# names are assigned in setup
names = self.index_names
level_names = [level.name for level in self.index.levels]
assert names == level_names
Expand Down
24 changes: 15 additions & 9 deletions pandas/tests/test_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,22 +8,28 @@

class TestConfig(object):

def __init__(self, *args):
super(TestConfig, self).__init__(*args)

@classmethod
def setup_class(cls):
from copy import deepcopy
self.cf = pd.core.config
self.gc = deepcopy(getattr(self.cf, '_global_config'))
self.do = deepcopy(getattr(self.cf, '_deprecated_options'))
self.ro = deepcopy(getattr(self.cf, '_registered_options'))

cls.cf = pd.core.config
cls.gc = deepcopy(getattr(cls.cf, '_global_config'))
cls.do = deepcopy(getattr(cls.cf, '_deprecated_options'))
cls.ro = deepcopy(getattr(cls.cf, '_registered_options'))

def setup_method(self, method):
setattr(self.cf, '_global_config', {})
setattr(
self.cf, 'options', self.cf.DictWrapper(self.cf._global_config))
setattr(self.cf, 'options', self.cf.DictWrapper(
self.cf._global_config))
setattr(self.cf, '_deprecated_options', {})
setattr(self.cf, '_registered_options', {})

# Our test fixture in conftest.py sets "chained_assignment"
# to "raise" only after all test methods have been setup.
# However, after this setup, there is no longer any
# "chained_assignment" option, so re-register it.
self.cf.register_option('chained_assignment', 'raise')

def teardown_method(self, method):
setattr(self.cf, '_global_config', self.gc)
setattr(self.cf, '_deprecated_options', self.do)
Expand Down