Skip to content

Commit 57e7403

Browse files
committed
fixed imports
1 parent fe6dbf0 commit 57e7403

File tree

1 file changed

+6
-10
lines changed

1 file changed

+6
-10
lines changed

pandas/tests/io/test_sql.py

+6-10
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020
import csv
2121
from datetime import date, datetime, time
2222
from io import StringIO
23-
import re
2423
import sqlite3
2524
import warnings
2625

@@ -1821,18 +1820,15 @@ def main(connectable):
18211820
def test_to_sql_with_negative_npinf(self, input):
18221821
# GH 34431
18231822

1824-
print(f"type(self.conn)={type(self.conn)}")
18251823
df = pd.DataFrame(input)
1826-
df.to_sql("foobar", self.conn, index=False)
1827-
try:
1824+
1825+
if self.conn.dialect.name == "mysql":
1826+
with pytest.raises(ValueError("inf can not be used with MySQL")):
1827+
df.to_sql("foobar", self.conn, index=False)
1828+
else:
1829+
df.to_sql("foobar", self.conn, index=False)
18281830
res = sql.read_sql_table("foobar", self.conn)
18291831
tm.assert_equal(df, res)
1830-
except ValueError as err:
1831-
mes = "inf can not be used with MySQL"
1832-
if re.search(mes, err.args[0]):
1833-
pass
1834-
else:
1835-
raise err
18361832

18371833
def test_temporary_table(self):
18381834
test_data = "Hello, World!"

0 commit comments

Comments
 (0)