File tree 1 file changed +6
-10
lines changed
1 file changed +6
-10
lines changed Original file line number Diff line number Diff line change 20
20
import csv
21
21
from datetime import date , datetime , time
22
22
from io import StringIO
23
- import re
24
23
import sqlite3
25
24
import warnings
26
25
@@ -1821,18 +1820,15 @@ def main(connectable):
1821
1820
def test_to_sql_with_negative_npinf (self , input ):
1822
1821
# GH 34431
1823
1822
1824
- print (f"type(self.conn)={ type (self .conn )} " )
1825
1823
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 )
1828
1830
res = sql .read_sql_table ("foobar" , self .conn )
1829
1831
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
1836
1832
1837
1833
def test_temporary_table (self ):
1838
1834
test_data = "Hello, World!"
You can’t perform that action at this time.
0 commit comments