def test_estimate_statement_cost_invalid_syntax(self): mock_cursor = mock.MagicMock() mock_cursor.execute.side_effect = Exception() with self.assertRaises(Exception): PrestoEngineSpec.estimate_statement_cost( "DROP TABLE brth_names", mock_cursor )
def test_estimate_statement_cost(self): mock_cursor = mock.MagicMock() estimate_json = {"a": "b"} mock_cursor.fetchone.return_value = [ '{"a": "b"}', ] result = PrestoEngineSpec.estimate_statement_cost( "SELECT * FROM brth_names", mock_cursor) assert result == estimate_json