Esempio n. 1
0
 def setUp(self):
     from outright.core.products import ProductsManager
     self._pm = ProductsManager() 
Esempio n. 2
0
class Test(unittest.TestCase):

    def setUp(self):
        from outright.core.products import ProductsManager
        self._pm = ProductsManager() 


    def tearDown(self):
        del self._pm

    def test_add_assign(self):
        self._pm.assign(1, 2, 3)
        self.assertEqual(self._pm.get_times(1, 2), 3)
        self.assertEqual(self._pm.get_times(2, 1), 3)
        self._pm.add(1, 2, 3)
        self.assertEqual(self._pm.get_times(1, 2), 6)
    def test_remove(self):
        self._pm.remove(1, 2)
        self.assertEqual(self._pm.get_times(2, 1), None)
    def test_add_products(self):
        prod_list = []
        with open('products.txt') as f:
            for line in f:
                prod_list.append(tuple(map(int, line.split())))
            self.assertEqual(True, self._pm.insert_product_list(prod_list))
        
    def test_recommend_next_product(self):
        self._pm.clear()
#        self.test_add_products()
        print(self._pm.recommend_next_product([1, 2, 3]))