[tests] black -t py34
This commit is contained in:
parent
e9e67ae375
commit
79fb28512f
10 changed files with 144 additions and 39 deletions
|
@ -3,10 +3,12 @@ import pytest
|
|||
|
||||
import core.config
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def defaultConfig():
|
||||
return core.config.Config([])
|
||||
|
||||
|
||||
def test_module():
|
||||
modules = ["module-1", "module-2", "module-3"]
|
||||
|
||||
|
@ -14,6 +16,7 @@ def test_module():
|
|||
|
||||
assert cfg.modules() == modules
|
||||
|
||||
|
||||
def test_module_ordering_maintained():
|
||||
modules = ["module-1", "module-5", "module-7"]
|
||||
more_modules = ["module-0", "module-2", "aaa"]
|
||||
|
@ -22,37 +25,45 @@ def test_module_ordering_maintained():
|
|||
|
||||
assert cfg.modules() == modules + more_modules
|
||||
|
||||
|
||||
def test_default_interval(defaultConfig):
|
||||
assert defaultConfig.interval() == 1
|
||||
|
||||
|
||||
def test_interval():
|
||||
interval = 4
|
||||
cfg = core.config.Config(["-p", "interval={}".format(interval)])
|
||||
|
||||
assert cfg.interval() == interval
|
||||
|
||||
|
||||
def test_floating_interval():
|
||||
interval = 4.5
|
||||
cfg = core.config.Config(["-p", "interval={}".format(interval)])
|
||||
|
||||
assert cfg.interval() == interval
|
||||
|
||||
|
||||
def test_default_theme(defaultConfig):
|
||||
assert defaultConfig.theme() == "default"
|
||||
|
||||
|
||||
def test_theme():
|
||||
theme_name = "sample-theme"
|
||||
cfg = core.config.Config(["-t", theme_name])
|
||||
assert cfg.theme() == theme_name
|
||||
|
||||
|
||||
def test_default_iconset(defaultConfig):
|
||||
assert defaultConfig.iconset() == "auto"
|
||||
|
||||
|
||||
def test_iconset():
|
||||
iconset_name = "random-iconset"
|
||||
cfg = core.config.Config(["-i", iconset_name])
|
||||
assert cfg.iconset() == iconset_name
|
||||
|
||||
|
||||
def test_reverse(defaultConfig):
|
||||
assert defaultConfig.reverse() == False
|
||||
|
||||
|
@ -60,6 +71,7 @@ def test_reverse(defaultConfig):
|
|||
|
||||
assert cfg.reverse() == True
|
||||
|
||||
|
||||
def test_logfile(defaultConfig):
|
||||
assert defaultConfig.logfile() is None
|
||||
|
||||
|
@ -68,7 +80,6 @@ def test_logfile(defaultConfig):
|
|||
assert cfg.logfile() == logfile
|
||||
|
||||
|
||||
|
||||
def test_all_modules():
|
||||
modules = core.config.all_modules()
|
||||
assert len(modules) > 0
|
||||
|
@ -84,8 +95,10 @@ def test_all_modules():
|
|||
"modules",
|
||||
)
|
||||
)
|
||||
assert os.path.exists(os.path.join(base, "contrib", pyname)) \
|
||||
or os.path.exists(os.path.join(base, "core", pyname))
|
||||
assert os.path.exists(os.path.join(base, "contrib", pyname)) or os.path.exists(
|
||||
os.path.join(base, "core", pyname)
|
||||
)
|
||||
|
||||
|
||||
def test_list_output(mocker):
|
||||
mocker.patch("core.config.sys")
|
||||
|
@ -93,10 +106,13 @@ def test_list_output(mocker):
|
|||
cfg = core.config.Config(["-l", "modules"])
|
||||
cfg = core.config.Config(["-l", "modules-rst"])
|
||||
|
||||
|
||||
def test_missing_parameter():
|
||||
cfg = core.config.Config(["-p", "test.key"])
|
||||
|
||||
assert cfg.get("test.key") == None
|
||||
assert cfg.get("test.key", "no-value-set") == "no-value-set"
|
||||
|
||||
|
||||
#
|
||||
# vim: tabstop=8 expandtab shiftwidth=4 softtabstop=4
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue