-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* running pytest * adding test_misc.py * adding jinja2 * adding pyproject.toml file
- Loading branch information
1 parent
c71f21a
commit c32d9f8
Showing
3 changed files
with
34 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,5 @@ | ||
[tool.pytest.ini_options] | ||
addopts = "-ra --cov" | ||
testpaths = ['tests'] | ||
pythonpath = ['.'] | ||
|
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,25 @@ | ||
|
||
from ush.python_utils.misc import * | ||
|
||
class TestMisc: | ||
"""Test the misc.py functions.""" | ||
|
||
def test_uc(self): | ||
"""Test the uppercase() function.""" | ||
assert uppercase('s') == 'S' | ||
|
||
def test_lc(self): | ||
"""Test the lowercase() function.""" | ||
assert lowercase('S') == 's' | ||
|
||
def test_find_pattern_in_str(self): | ||
"""Test the find_pattern_in_str() function.""" | ||
assert not find_pattern_in_str('.', 's') | ||
|
||
def test_find_pattern_in_fike(self): | ||
"""Test the find_pattern_in_file() function.""" | ||
f = open("test_misc.txt", "w") | ||
f.write("Hello World from " + f.name) | ||
f.close() | ||
assert not find_pattern_in_file('H', "test_misc.txt") | ||
|