def test_cte_deletes_duplicates(self): sql_runner = SQLRunner() cursor = sql_runner.execute_seed_file() cursor = sql_runner.execute_cte_deletes_duplicates() result = [(27, )] self.assertEqual( cursor.execute("SELECT COUNT(*) FROM sales;").fetchall(), result)
def test_correct_above_avg_sales(self): sql_runner = SQLRunner() cursor = sql_runner.execute_seed_file() cursor = sql_runner.execute_cte_deletes_duplicates() result = [ ('Manhattan', '2018-04-22', 60), ('Manhattan', '2018-04-23', 80), ('Brooklyn', '2018-04-21', 90), ('Brooklyn', '2018-04-22', 80), ('Brooklyn', '2018-04-22', 80), ('Brooklyn', '2018-04-22', 70), ('Brooklyn', '2018-04-23', 90), ('Brooklyn', '2018-04-23', 80), ('London', '2018-04-21', 100), ('London', '2018-04-22', 75) ] self.assertEqual( cursor.execute(correct_above_avg_sales()).fetchall(), result)