def test_get_entries_returned_map_sorted(self): products = [ Product('Pa12', 1), Product('Ps23', 2), Product('Pd235', 1) ] server = MapServer(products) entries = server.get_entries(2) self.assertEqual(entries, [products[0], products[2], products[1]])
def test_error_throw(self): products = [ Product('QWE21', 1), Product('qWE21', 2), Product('AQS22', 3), Product('VCS21', 4), Product('QWS45', 5) ] server = MapServer(products) with self.assertRaises(TooManyProductsFoundError): entries = server.get_entries(3)
def test_return_emptyList_fromMapServer(self): products = [] prod = MapServer(products) emptylist = prod.get_entries(2) self.assertEqual(emptylist,[])