-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Paired Challenge Exercise: design single function program
- Loading branch information
0 parents
commit 1b26bca
Showing
6 changed files
with
138 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,12 @@ | ||
[[source]] | ||
url = "https://pypi.org/simple" | ||
verify_ssl = true | ||
name = "pypi" | ||
|
||
[packages] | ||
pytest = "*" | ||
|
||
[dev-packages] | ||
|
||
[requires] | ||
python_version = "3.11" |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Empty file.
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,9 @@ | ||
# As a user | ||
# So that I can keep track of my tasks | ||
# I want to check if a text includes the string `#TODO`. | ||
|
||
def check_todo(text): | ||
if '#TODO' in text.upper(): | ||
return text | ||
else: | ||
raise Exception('No #TODO tasks') |
Empty file.
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,63 @@ | ||
# As a user | ||
# So that I can keep track of my tasks | ||
# I want to check if a text includes the string `#TODO`. | ||
|
||
''' | ||
check | ||
def check_todo(text): | ||
param = (text) | ||
text: string containing multiple things including ideally '#TODO' | ||
return: | ||
string if it contains '#TODO' | ||
side effects: | ||
if there isn't any '#TODO' it would return error saying there's no tasks | ||
''' | ||
pass | ||
|
||
|
||
from lib.todo_list import check_todo | ||
import pytest | ||
|
||
|
||
''' | ||
test to see if the text has no content | ||
''' | ||
|
||
def test_check_no_content(): | ||
|
||
with pytest.raises(Exception) as err: | ||
outcome = check_todo('') | ||
error = str(err.value) | ||
assert error == 'No #TODO tasks' | ||
|
||
|
||
''' | ||
check if the text contains '#TODO' | ||
''' | ||
|
||
def test_check_todo(): | ||
tasks = check_todo('testing to see if #TODO is detected') | ||
assert tasks == 'testing to see if #TODO is detected' | ||
|
||
''' | ||
check for the absence of #TODO | ||
''' | ||
|
||
def test_check_lack_of_todo(): | ||
|
||
with pytest.raises(Exception) as err: | ||
no_tasks = check_todo('testing to see if this works') | ||
error_msg = str(err.value) | ||
assert error_msg == 'No #TODO tasks' | ||
|
||
|
||
''' | ||
check for #TODO but not necesarily in capitals | ||
''' | ||
|
||
def test_todos_in_lowerc(): | ||
todos = check_todo('testing to see if #toDo works') | ||
assert todos == 'testing to see if #toDo works' |