diff --git a/src/riceinfo/rice.py b/src/riceinfo/rice.py index aa03932..d906f0f 100644 --- a/src/riceinfo/rice.py +++ b/src/riceinfo/rice.py @@ -43,6 +43,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, sashimi, and 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() + + print(rice_country[country_name]) + def history(century): if century == 1: diff --git a/tests/test_riceCountry.py b/tests/test_riceCountry.py new file mode 100644 index 0000000..2b9c51b --- /dev/null +++ b/tests/test_riceCountry.py @@ -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 \ No newline at end of file