-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
49 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
from pymatchseries import config_tools as ctools | ||
import os | ||
import pytest | ||
|
||
|
||
def test_load_config(): | ||
ctools.load_config() | ||
|
||
|
||
def test_write_config(): | ||
dummy = ctools.load_config() | ||
ctools.write_config(dummy, "test_config.par") | ||
assert os.path.isfile("test_config.par") | ||
os.remove("test_config.par") | ||
|
||
|
||
def test_get_configuration(): | ||
c = ctools.get_configuration("test", "test", 2, | ||
1, [1, 2, 3], | ||
preSmoothSigma=1) | ||
assert isinstance(c, ctools.config_dict) | ||
|
||
|
||
def test_create_config_file(): | ||
ctools.create_config_file("test.par", "test", "test", 2, | ||
1, [1, 2, 3], | ||
preSmoothSigma=1) | ||
assert os.path.isfile("test.par") | ||
os.remove("test.par") | ||
|
||
|
||
class TestConfigDict(): | ||
|
||
def test_init(self): | ||
testdict = {"foo": "bar", "batman": 1} | ||
c = ctools.config_dict(testdict) | ||
assert isinstance(c, ctools.config_dict) | ||
|
||
def test_get(self): | ||
testdict = {"foo": "bar", "batman": 1} | ||
c = ctools.config_dict(testdict) | ||
assert c.foo == "bar" | ||
|
||
def test_set(self): | ||
testdict = {"foo": "bar", "batman": 1} | ||
c = ctools.config_dict(testdict) | ||
c.foo == "foo" | ||
assert c.foo == "bar" |