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

Update tests to catch corner cases students hit #22

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 16 additions & 1 deletion tests/test_wave_01.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,4 +73,19 @@ def test_draw_letters_returns_different_hands():
hand3 = draw_letters()

# Assert
assert hand1 != hand2 or hand2 != hand3
assert hand1 != hand2 or hand2 != hand3

def test_ever_draws_duplicate_letters():
# Arrange
def has_dupes(letter_bank):
unique_letters = set(letter_bank)
return len(unique_letters) != len(letter_bank)

# Act
saw_a_duplicate = False
for i in range(1000):
letters = draw_letters()
saw_a_duplicate = saw_a_duplicate or has_dupes(letters)

# Assert
assert saw_a_duplicate
2 changes: 1 addition & 1 deletion tests/test_wave_04.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ def test_get_highest_word_many_ties_pick_shortest():

def test_get_highest_word_does_not_return_early_after_first_tiebreaker():
# Arrange
words = ["WWW", "MMMM", "BBBBBB", "AAAAAAAAD", "JQ", "KFHK"]
words = ["WWW", "MMMM", "BBBBBB", "AAAAAAAAD", "JQ", "KFHK", "A"]

# Act
best_word = get_highest_word_score(words)
Expand Down