def test_file_path_extension_row(self): with self.assertRaises(expected_exception=Exception): model_inventory.analyse_orders_from_file_row( file_path='test.tt', reorder_cost=Decimal(450), z_value=Decimal(1.28), retail_price=Decimal(455))
def test_file_path_extension_col(self): # arrange, act app_dir = os.path.dirname(__file__, ) rel_path = 'supplychainpy/test.tt' abs_file_path = os.path.abspath(os.path.join(app_dir, '..', rel_path)) with self.assertRaises(expected_exception=Exception): model_inventory.analyse_orders_from_file_row(abs_file_path, reorder_cost=Decimal(450), z_value=Decimal(1.28), retail_price=Decimal(100))
def test_file_path_extension_col(self): # arrange, act app_dir = os.path.dirname(__file__, ) rel_path = 'supplychainpy/test.tt' abs_file_path = os.path.abspath(os.path.join(app_dir, '..', rel_path)) with self.assertRaises(expected_exception=Exception): model_inventory.analyse_orders_from_file_row(abs_file_path, reorder_cost=Decimal(450), z_value=Decimal(1.28), retail_price=Decimal(100))
def test_file_path_extension_row(self): # arrange,act app_dir = os.path.dirname(__file__, ) rel_path = 'supplychainpy/tel.tt' abs_file_path = os.path.abspath(os.path.join(app_dir, '..', rel_path)) # assert with self.assertRaises(expected_exception=Exception): d = model_inventory.analyse_orders_from_file_row(abs_file_path, 1.28, 400, file_type="text")
def test_standard_deviation_row_count(self): # arrange, act app_dir = os.path.dirname(__file__, ) rel_path = 'supplychainpy/test_row_small.txt' abs_file_path = os.path.abspath(os.path.join(app_dir, '..', rel_path)) d = model_inventory.analyse_orders_from_file_row(abs_file_path, Decimal(1.28), Decimal(400)) # assert self.assertEqual(len(d), 16)
def test_standard_deviation_row_value(self): """Test Standard deviation value of row data, from text file.""" std = 0 d = model_inventory.analyse_orders_from_file_row(file_path=ABS_FILE_PATH['PARTIAL_ROW_TXT_SM'], retail_price=Decimal(400), reorder_cost=Decimal(450), z_value=Decimal(1.28)) for row in d: std = row.get('standard_deviation') self.assertEqual(Decimal(std), 25)
def test_standard_deviation_row_value(self): """Test Standard deviation value of row data, from text file.""" std = 0 d = model_inventory.analyse_orders_from_file_row(file_path=ABS_FILE_PATH['PARTIAL_ROW_TXT_SM'], retail_price=Decimal(400), reorder_cost=Decimal(450), z_value=Decimal(1.28)) for row in d: std = row.get('standard_deviation') self.assertEqual(Decimal(std), 25)
def test_standard_deviation_row_value(self): # arrange app_dir = os.path.dirname(__file__, ) rel_path = 'supplychainpy/test_row_small.txt' abs_file_path = os.path.abspath(os.path.join(app_dir, '..', rel_path)) # act d = model_inventory.analyse_orders_from_file_row(abs_file_path, 1.28, 400) for row in d: std = row.get('standard_deviation') # assert self.assertEqual(Decimal(std), 25)
def test_analyse_orders_from_file_row_csv(self): # arrange app_dir = os.path.dirname(__file__, ) rel_path = 'supplychainpy/data.csv' abs_file_path = os.path.abspath(os.path.join(app_dir, '..', rel_path)) # act d = model_inventory.analyse_orders_from_file_row(abs_file_path, z_value=Decimal(1.28), reorder_cost=Decimal(400), file_type="csv") for row in d: if row['sku'] == 'KR202-209': std = row.get('standard_deviation') # assert self.assertTrue(isclose(Decimal(std), 976, abs_tol=2))
def test_analyse_orders_from_file_row_csv(self): """""" d = model_inventory.analyse_orders_from_file_row(file_path=ABS_FILE_PATH['COMPLETE_CSV_SM'], reorder_cost=Decimal(45), z_value=Decimal(1.28), file_type="csv", retail_price=Decimal(30), currency='USD') std = 0 for row in d: if row.get('sku') == 'KR202-210': std = row.get('standard_deviation') break # assert self.assertTrue(isclose(Decimal(std), 950, abs_tol=2))
def test_analyse_orders_from_file_row_csv(self): """""" d = model_inventory.analyse_orders_from_file_row(file_path=ABS_FILE_PATH['COMPLETE_CSV_SM'], reorder_cost=Decimal(45), z_value=Decimal(1.28), file_type="csv", retail_price=Decimal(30), currency='USD') std = 0 for row in d: if row.get('sku') == 'KR202-210': std = row.get('standard_deviation') break # assert self.assertTrue(isclose(Decimal(std), 950, abs_tol=2))
def test_analyse_orders_from_file_row_csv(self): # arrange app_dir = os.path.dirname(__file__, ) rel_path = 'supplychainpy/data2.csv' abs_file_path = os.path.abspath(os.path.join(app_dir, '..', rel_path)) # act d = model_inventory.analyse_orders_from_file_row(file_path=abs_file_path, reorder_cost=Decimal(45), z_value=Decimal(1.28), file_type="csv", retail_price=Decimal(30), currency='USD') std = 0 for row in d: if row['sku'] == 'KR202-210': std = row.get('standard_deviation') break # assert self.assertTrue(isclose(Decimal(std), 950, abs_tol=2))
def test_file_path_extension_row(self): with self.assertRaises(expected_exception=Exception): model_inventory.analyse_orders_from_file_row(file_path='test.tt', reorder_cost=Decimal(450), z_value=Decimal(1.28), retail_price=Decimal(455))