-
Notifications
You must be signed in to change notification settings - Fork 1
/
ingredientfinder_tests.py
35 lines (26 loc) · 1011 Bytes
/
ingredientfinder_tests.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
import unittest
from ingredientFinder import IngredientRecipeFinder
class IngredientRecipeFinderTest(unittest.TestCase):
def setUp(self):
self.irf = IngredientRecipeFinder()
def test_typoInTerm(self):
terms = ['Basilikuum']
result = self.irf.search(terms)
self.assertEqual(len(result), 0)
def test_amountDefaultResults(self):
terms = ['Nudeln']
results = self.irf.search(terms)
self.assertEqual(len(results), 5)
def test_inputResult(self):
terms = ['Nudeln']
amountResults = 10
results = self.irf.search(terms, amountResults)
self.assertEqual(len(results), 10)
def test_stringAsInputType(self):
terms = 'Nudeln'
result = self.irf.search(terms)
self.assertIsNotNone(result)
def test_orderOfResults(self):
terms = ['Nudeln', 'Butter', 'Basilikum']
result = self.irf.search(terms)
self.assertGreaterEqual(result[0]['score'], result[1]['score'])