Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
Полина Соколова
assignment-2-dictionary
Commits
ba0c6986
Commit
ba0c6986
authored
4 months ago
by
Полина Соколова
Browse files
Options
Download
Email Patches
Plain Diff
Add new file
parent
8650a65b
master
No related merge requests found
Pipeline
#99300
failed with stages
in 5 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
29 additions
and
0 deletions
+29
-0
main.py
main.py
+29
-0
No files found.
main.py
0 → 100644
View file @
ba0c6986
import
subprocess
long_str
=
"itmo"
*
64
input_data
=
[
"third_word"
,
"second_word"
,
"first_word"
,
"ahahah"
,
long_str
]
success_codes
=
[
"WOWOWOW"
,
"SIMPLE STRING IN HIGH REGISTER"
"simple string in low register"
,
"PUMPA and LUMPA"
,
""
,
""
]
error_codes
=
[
""
,
""
,
""
,
"No such word in the dict"
,
"An error occurred while reading the string"
]
path
=
"./my_program"
for
i
,
test_input
in
enumerate
(
input_data
):
process
=
subprocess
.
run
(
path
,
input
=
test_input
,
text
=
True
,
capture_output
=
True
)
stdout
=
process
.
stdout
.
strip
()
stderr
=
process
.
stderr
.
strip
()
if
stdout
!=
success_codes
[
i
]:
print
(
f
"Test #
{
i
+
1
}
failed: got
{
stdout
}
, expected
{
success_codes
[
i
]
}
"
)
elif
stderr
!=
error_codes
[
i
]:
print
(
f
"Test #
{
i
+
1
}
failed: got
{
stderr
}
, expected
{
error_codes
[
i
]
}
"
)
else
:
print
(
f
"Test #
{
i
+
1
}
passed!"
)
# print(str_out)
# print(str_err)
print
(
"==========================="
)
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment
Menu
Projects
Groups
Snippets
Help