test_sentences

py

School

Brigham Young University, Idaho *

*We aren’t endorsed by this school

Course

111

Subject

Computer Science

Date

Feb 20, 2024

Type

py

Pages

2

Uploaded by CaptainMaskPelican29

Report
from webbrowser import get from sentences import get_determiner, get_noun, get_verb import random import pytest quantity_1 = 1 quantity_2 = 2 tense = ["past", "present", "future"] def test_get_determiner(): # 1. Test the single determiners. single_determiners = ["a", "one", "the"] # This loop will repeat the statements inside it 4 times. # If a loop's counting variable is not used inside the # body of the loop, many programmers will use underscore # (_) as the variable name for the counting variable. for _ in range(4): # Call the get_determiner function which # should return a single determiner. word = get_determiner(1) # Verify that the word returned from get_determiner # is one of the words in the single_determiners list. assert word in single_determiners # 2. Test the plural determiners. plural_determiners = ["some", "many", "the"] # This loop will repeat the statements inside it 4 times. for _ in range(4): # Call the get_determiner function which # should return a plural determiner. word = get_determiner(2) # Verify that the word returned from get_determiner # is one of the words in the plural_determiners list. assert word in plural_determiners def test_get_noun(): # 1 test single nouns single_nouns = ["bird", "boy", "car", "cat", "child", "dog", "girl", "man", "rabbit", "woman"] for _ in range(4): noun = get_noun(1) assert noun in single_nouns # 2 test plural nouns plural_nouns = ["birds", "boys", "cars", "cats", "children", "dogs", "girls", "men", "rabbits", "women"] for _ in range(4): noun = get_noun(2)
assert noun in plural_nouns def test_get_verb(): # 1 test past past_verbs = ["drank", "ate", "grew", "laughed", "thought", "ran", "slept", "talked", "walked", "wrote"] for _ in range(4): verb = get_verb(1, "past") assert verb in past_verbs # 2 single present single_present_verbs = ["drinks", "eats", "grows", "laughs", "thinks", "runs", "sleeps", "talks", "walks", "writes"] for _ in range(4): verb = get_verb(1, "present") assert verb in single_present_verbs # 3 plural present plural_present_verbs = ["drink", "eat", "grow", "laugh", "think", "run", "sleep", "talk", "walk", "write"] for _ in range(4): verb = get_verb(2, "present") assert verb in plural_present_verbs # 4 future future_verbs = ["will drink", "will eat", "will grow", "will laugh", "will think", "will run", "will sleep", "will talk", "will walk", "will write"] for _ in range(4): verb = get_verb(1, "future") assert verb in future_verbs pytest.main(["-v", "--tb=line", "-rN", __file__])
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help