Skip to content

Commit

Permalink
Fix indent
Browse files Browse the repository at this point in the history
  • Loading branch information
laughingman7743 committed May 2, 2020
1 parent 14e98a4 commit 1435846
Show file tree
Hide file tree
Showing 7 changed files with 479 additions and 398 deletions.
8 changes: 4 additions & 4 deletions tests/test_async_cursor.py
Original file line number Diff line number Diff line change
Expand Up @@ -178,10 +178,10 @@ def test_bad_query(self, cursor):
def test_cancel(self, cursor):
query_id, future = cursor.execute(
"""
SELECT a.a * rand(), b.a * rand()
FROM many_rows a
CROSS JOIN many_rows b
"""
SELECT a.a * rand(), b.a * rand()
FROM many_rows a
CROSS JOIN many_rows b
"""
)
time.sleep(randint(1, 5))
cursor.cancel(query_id)
Expand Down
20 changes: 10 additions & 10 deletions tests/test_async_pandas_cursor.py
Original file line number Diff line number Diff line change
Expand Up @@ -184,10 +184,10 @@ def test_many_as_pandas(self, cursor):
def test_cancel(self, cursor):
query_id, future = cursor.execute(
"""
SELECT a.a * rand(), b.a * rand()
FROM many_rows a
CROSS JOIN many_rows b
"""
SELECT a.a * rand(), b.a * rand()
FROM many_rows a
CROSS JOIN many_rows b
"""
)
time.sleep(randint(1, 5))
cursor.cancel(query_id)
Expand Down Expand Up @@ -221,12 +221,12 @@ def test_empty_result(self, cursor):
location = "{0}{1}/{2}/".format(ENV.s3_staging_dir, S3_PREFIX, table)
query_id, future = cursor.execute(
"""
CREATE EXTERNAL TABLE IF NOT EXISTS
{schema}.{table} (number_of_rows INT)
ROW FORMAT DELIMITED FIELDS TERMINATED BY '\t'
LINES TERMINATED BY '\n' STORED AS TEXTFILE
LOCATION '{location}'
""".format(
CREATE EXTERNAL TABLE IF NOT EXISTS
{schema}.{table} (number_of_rows INT)
ROW FORMAT DELIMITED FIELDS TERMINATED BY '\t'
LINES TERMINATED BY '\n' STORED AS TEXTFILE
LOCATION '{location}'
""".format(
schema=SCHEMA, table=table, location=location
)
)
Expand Down
92 changes: 46 additions & 46 deletions tests/test_cursor.py
Original file line number Diff line number Diff line change
Expand Up @@ -186,30 +186,30 @@ def test_no_params(self, cursor):
def test_contain_special_character_query(self, cursor):
cursor.execute(
"""
SELECT col_string FROM one_row_complex
WHERE col_string LIKE '%str%'
"""
SELECT col_string FROM one_row_complex
WHERE col_string LIKE '%str%'
"""
)
self.assertEqual(cursor.fetchall(), [("a string",)])
cursor.execute(
"""
SELECT col_string FROM one_row_complex
WHERE col_string LIKE '%%str%%'
"""
SELECT col_string FROM one_row_complex
WHERE col_string LIKE '%%str%%'
"""
)
self.assertEqual(cursor.fetchall(), [("a string",)])
cursor.execute(
"""
SELECT col_string, '%' FROM one_row_complex
WHERE col_string LIKE '%str%'
"""
SELECT col_string, '%' FROM one_row_complex
WHERE col_string LIKE '%str%'
"""
)
self.assertEqual(cursor.fetchall(), [("a string", "%")])
cursor.execute(
"""
SELECT col_string, '%%' FROM one_row_complex
WHERE col_string LIKE '%%str%%'
"""
SELECT col_string, '%%' FROM one_row_complex
WHERE col_string LIKE '%%str%%'
"""
)
self.assertEqual(cursor.fetchall(), [("a string", "%%")])

Expand All @@ -219,9 +219,9 @@ def test_contain_special_character_query_with_parameter(self, cursor):
TypeError,
lambda: cursor.execute(
"""
SELECT col_string, %(param)s FROM one_row_complex
WHERE col_string LIKE '%str%'
""",
SELECT col_string, %(param)s FROM one_row_complex
WHERE col_string LIKE '%str%'
""",
{"param": "a string"},
),
)
Expand All @@ -237,9 +237,9 @@ def test_contain_special_character_query_with_parameter(self, cursor):
ValueError,
lambda: cursor.execute(
"""
SELECT col_string, '%' FROM one_row_complex
WHERE col_string LIKE %(param)s
""",
SELECT col_string, '%' FROM one_row_complex
WHERE col_string LIKE %(param)s
""",
{"param": "%str%"},
),
)
Expand Down Expand Up @@ -337,27 +337,27 @@ def test_query_execution_initial(self, cursor):
def test_complex(self, cursor):
cursor.execute(
"""
SELECT
col_boolean
,col_tinyint
,col_smallint
,col_int
,col_bigint
,col_float
,col_double
,col_string
,col_timestamp
,CAST(col_timestamp AS time) AS col_time
,col_date
,col_binary
,col_array
,CAST(col_array AS json) AS col_array_json
,col_map
,CAST(col_map AS json) AS col_map_json
,col_struct
,col_decimal
FROM one_row_complex
"""
SELECT
col_boolean
,col_tinyint
,col_smallint
,col_int
,col_bigint
,col_float
,col_double
,col_string
,col_timestamp
,CAST(col_timestamp AS time) AS col_time
,col_date
,col_binary
,col_array
,CAST(col_array AS json) AS col_array_json
,col_map
,CAST(col_map AS json) AS col_map_json
,col_struct
,col_decimal
FROM one_row_complex
"""
)
self.assertEqual(
cursor.description,
Expand Down Expand Up @@ -446,10 +446,10 @@ def cancel(c):
DatabaseError,
lambda: cursor.execute(
"""
SELECT a.a * rand(), b.a * rand()
FROM many_rows a
CROSS JOIN many_rows b
"""
SELECT a.a * rand(), b.a * rand()
FROM many_rows a
CROSS JOIN many_rows b
"""
),
)

Expand Down Expand Up @@ -488,9 +488,9 @@ def test_show_partition(self, cursor):
for i in xrange(10):
cursor.execute(
"""
ALTER TABLE partition_table ADD PARTITION (b=%(b)d)
LOCATION %(location)s
""",
ALTER TABLE partition_table ADD PARTITION (b=%(b)d)
LOCATION %(location)s
""",
{"b": i, "location": location},
)
cursor.execute("SHOW PARTITIONS partition_table")
Expand Down
Loading

0 comments on commit 1435846

Please sign in to comment.