Skip to content

Commit

Permalink
Merge pull request #18 from software-students-fall2023/andrew
Browse files Browse the repository at this point in the history
rice country
  • Loading branch information
kingslayerrq authored Nov 6, 2023
2 parents fff5c82 + 8447241 commit 92d99ed
Show file tree
Hide file tree
Showing 2 changed files with 74 additions and 0 deletions.
24 changes: 24 additions & 0 deletions src/riceinfo/rice.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,30 @@ def tellPun(punType: Pun) -> str:
return random.choice(punsDict[Pun.RHYME])
case default:
return "not a valid PUN TYPE"

def riceCountry(country_name):
country_name = country_name.lower()

rice_country = {
'brazil': 'Brazillian markets often sell a traditional variety of a short-grain rice called Arborio, which is commonly used for risotto.',
'egypt': 'Egypt consumes a variety of different rice, including Japonica, but is most known for Giza 178 rice, a medium-grain variety that is commonly used in traditional Egyptian dishes.',
'mexico': 'Mexico often uses a long-grain Patna rice, which is known for its long kernel and grain length.',
'nigeria': 'Nigeria primarily uses Ofada rice, which is an indigenous rice that consists mostly of blends containing African rice.',
'china': 'China is a major consumer of traditional jasmine rice, though they use many different varieties of short, medium, and long grain rice, depending on the dish.',
'thailand': 'Thailand is famous for its fragrant Jasmine rice, which is a long-grain rice variety known for its unique aroma and flavor.',
'indonesia': 'Indonesia commonly uses Pandan rice, which is jasmine rice cooked in pandan leaves and is used in dishes like Nasi Goreng.',
'japan': 'Japan primarily uses a short grain Koshihikari rice for sushi and other traditional Japanese dishes.',
'south korea': 'South Korea mainly uses Calrose rice, a medium grain variety which is used for dishes like Bibimbap and Kimbap.'
}

while country_name not in rice_country:
print("Error: Invalid country name. Please choose from the following options:")
for option in rice_country:
print(option.capitalize())
country_name = input("Please enter a valid country name: ").lower()

return (rice_country[country_name])


def history(century):
if century == 1:
Expand Down
50 changes: 50 additions & 0 deletions tests/test_riceCountry.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
from src.riceinfo.rice import riceinfo
import pytest

class Tests:
## python -m pytest
def test_brazil(self):
testcase = riceinfo.riceCountry("brazil")
expected = 'Brazillian markets often sell a traditional variety of a short-grain rice called Arborio, which is commonly used for risotto.'
assert isinstance(testcase, str), f"Expected riceCountry() to return a string. Instead it returned a {testcase}"
assert testcase == expected
def test_egypt(self):
testcase = riceinfo.riceCountry("egypt")
expected = 'Egypt consumes a variety of different rice, including Japonica, but is most known for Giza 178 rice, a medium-grain variety that is commonly used in traditional Egyptian dishes.'
assert isinstance(testcase, str), f"Expected riceCountry() to return a string. Instead it returned a {testcase}"
assert testcase == expected
def test_mexico(self):
testcase = riceinfo.riceCountry("mexico")
expected = 'Mexico often uses a long-grain Patna rice, which is known for its long kernel and grain length.'
assert isinstance(testcase, str), f"Expected riceCountry() to return a string. Instead it returned a {testcase}"
assert testcase == expected
def test_nigeria(self):
testcase = riceinfo.riceCountry("nigeria")
expected = 'Nigeria primarily uses Ofada rice, which is an indigenous rice that consists mostly of blends containing African rice.'
assert isinstance(testcase, str), f"Expected riceCountry() to return a string. Instead it returned a {testcase}"
assert testcase == expected
def test_china(self):
testcase = riceinfo.riceCountry("china")
expected = 'China is a major consumer of traditional jasmine rice, though they use many different varieties of short, medium, and long grain rice, depending on the dish.'
assert isinstance(testcase, str), f"Expected riceCountry() to return a string. Instead it returned a {testcase}"
assert testcase == expected
def test_thailand(self):
testcase = riceinfo.riceCountry("thailand")
expected = 'Thailand is famous for its fragrant Jasmine rice, which is a long-grain rice variety known for its unique aroma and flavor.'
assert isinstance(testcase, str), f"Expected riceCountry() to return a string. Instead it returned a {testcase}"
assert testcase == expected
def test_indonesia(self):
testcase = riceinfo.riceCountry("indonesia")
expected = 'Indonesia commonly uses Pandan rice, which is jasmine rice cooked in pandan leaves and is used in dishes like Nasi Goreng.'
assert isinstance(testcase, str), f"Expected riceCountry() to return a string. Instead it returned a {testcase}"
assert testcase == expected
def test_japan(self):
testcase = riceinfo.riceCountry("japan")
expected = 'Japan primarily uses a short grain Koshihikari rice for sushi and other traditional Japanese dishes.'
assert isinstance(testcase, str), f"Expected riceCountry() to return a string. Instead it returned a {testcase}"
assert testcase == expected
def test_south_korea(self):
testcase = riceinfo.riceCountry("south korea")
expected = 'South Korea mainly uses Calrose rice, a medium grain variety which is used for dishes like Bibimbap and Kimbap.'
assert isinstance(testcase, str), f"Expected riceCountry() to return a string. Instead it returned a {testcase}"
assert testcase == expected

0 comments on commit 92d99ed

Please sign in to comment.