-
-
Notifications
You must be signed in to change notification settings - Fork 196
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test: add load and clean txt file test
- Loading branch information
1 parent
1559c8a
commit 6fad04c
Showing
3 changed files
with
35 additions
and
0 deletions.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
from GramAddict.core.interaction import _load_and_clean_txt_file | ||
|
||
|
||
def test_load_txt_ok(mocker): | ||
mocker.patch("os.path.join", return_value="txt/txt_ok.txt") | ||
message = _load_and_clean_txt_file("test_user", "txt_filename") | ||
assert message is not None | ||
assert message == [ | ||
"Hello, test_user! How are you today?", | ||
"Hello everyone!", | ||
"Goodbye, test_user! Have a great day!", | ||
] | ||
|
||
|
||
def test_load_txt_empty(mocker): | ||
mocker.patch("os.path.join", return_value="txt/txt_empty.txt") | ||
message = _load_and_clean_txt_file("test_user", "txt_filename") | ||
assert message is None | ||
|
||
|
||
def test_load_txt_not_exists(mocker): | ||
mocker.patch("os.path.join", return_value="txt/txt_not_exists.txt") | ||
message = _load_and_clean_txt_file("test_user", "txt_filename") | ||
assert message is None |
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 @@ | ||
|
||
|
||
|
||
|
||
|
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,6 @@ | ||
|
||
Hello, test_user! How are you today? | ||
Hello everyone! | ||
|
||
Goodbye, test_user! Have a great day! | ||
|