Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit6fad04c

Browse files
committed
test: add load and clean txt file test
1 parent1559c8a commit6fad04c

File tree

3 files changed

+35
-0
lines changed

3 files changed

+35
-0
lines changed

‎test/test_load_txt.py‎

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
fromGramAddict.core.interactionimport_load_and_clean_txt_file
2+
3+
4+
deftest_load_txt_ok(mocker):
5+
mocker.patch("os.path.join",return_value="txt/txt_ok.txt")
6+
message=_load_and_clean_txt_file("test_user","txt_filename")
7+
assertmessageisnotNone
8+
assertmessage== [
9+
"Hello, test_user! How are you today?",
10+
"Hello everyone!",
11+
"Goodbye, test_user! Have a great day!",
12+
]
13+
14+
15+
deftest_load_txt_empty(mocker):
16+
mocker.patch("os.path.join",return_value="txt/txt_empty.txt")
17+
message=_load_and_clean_txt_file("test_user","txt_filename")
18+
assertmessageisNone
19+
20+
21+
deftest_load_txt_not_exists(mocker):
22+
mocker.patch("os.path.join",return_value="txt/txt_not_exists.txt")
23+
message=_load_and_clean_txt_file("test_user","txt_filename")
24+
assertmessageisNone

‎test/txt/txt_empty.txt‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
2+
3+
4+
5+

‎test/txt/txt_ok.txt‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
2+
Hello, test_user! How are you today?
3+
Hello everyone!
4+
5+
Goodbye, test_user! Have a great day!
6+

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp