Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create is_odd() function for added clarity #5

Merged
merged 3 commits into from
Apr 3, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 4 additions & 0 deletions is_even/is_even.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@ def is_even(number):
raise Exception(r.json()["error"])


def is_odd(number):
return not is_even(number)


if __name__ == '__main__':

for i in range(10):
Expand Down
11 changes: 9 additions & 2 deletions test_is_even.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,16 @@ def test_even(seff):
assert (even is True)

def test_odd(self):
odd = is_even.is_even(3)
odd = is_even.is_odd(3)
assert(odd is True)

assert(odd is False)
def test_not_even(self):
even = is_even.is_even(3)
assert (even is False)

def test_not_odd(self):
even = is_even.is_odd(2)
assert (even is False)

def test_cache(self):
assert (is_even.is_even(2) is True)
Expand Down