attrs/tests/test_config.py

34 lines
882 B
Python
Raw Normal View History

"""
Tests for `attr._config`.
"""
from __future__ import absolute_import, division, print_function
from attr import _config
class TestConfig(object):
def test_default(self):
"""
Run validators by default.
"""
assert True is _config._run_validators
def test_set_run_validators(self):
"""
Sets `_run_validators`.
"""
_config.set_run_validators(False)
assert False is _config._run_validators
_config.set_run_validators(True)
assert True is _config._run_validators
def test_get_run_validators(self):
"""
Returns `_run_validators`.
"""
_config._run_validators = False
assert _config._run_validators is _config.get_run_validators()
_config._run_validators = True
assert _config._run_validators is _config.get_run_validators()