@@ -495,7 +495,7 @@ def test_read_table_absent(self):
495
495
self .assertRaises (
496
496
ValueError , sql .read_table , "this_doesnt_exist" , con = self .conn )
497
497
498
- def test_default_type_convertion (self ):
498
+ def test_default_type_conversion (self ):
499
499
df = sql .read_table ("types_test_data" , self .conn )
500
500
501
501
self .assertTrue (issubclass (df .FloatCol .dtype .type , np .floating ),
@@ -589,7 +589,7 @@ def setUp(self):
589
589
590
590
self ._load_test1_data ()
591
591
592
- def test_default_type_convertion (self ):
592
+ def test_default_type_conversion (self ):
593
593
df = sql .read_table ("types_test_data" , self .conn )
594
594
595
595
self .assertTrue (issubclass (df .FloatCol .dtype .type , np .floating ),
@@ -755,6 +755,24 @@ def tearDown(self):
755
755
for table in c .fetchall ():
756
756
self .conn .execute ('DROP TABLE %s' % table [0 ])
757
757
758
+ def test_default_type_conversion (self ):
759
+ df = sql .read_table ("types_test_data" , self .conn )
760
+
761
+ self .assertTrue (issubclass (df .FloatCol .dtype .type , np .floating ),
762
+ "FloatCol loaded with incorrect type" )
763
+ self .assertTrue (issubclass (df .IntCol .dtype .type , np .integer ),
764
+ "IntCol loaded with incorrect type" )
765
+ # MySQL has no real BOOL type (it's an alias for TINYINT)
766
+ self .assertTrue (issubclass (df .BoolCol .dtype .type , np .integer ),
767
+ "BoolCol loaded with incorrect type" )
768
+
769
+ # Int column with NA values stays as float
770
+ self .assertTrue (issubclass (df .IntColWithNull .dtype .type , np .floating ),
771
+ "IntColWithNull loaded with incorrect type" )
772
+ # Bool column with NA = int column with NA values => becomes float
773
+ self .assertTrue (issubclass (df .BoolColWithNull .dtype .type , np .floating ),
774
+ "BoolColWithNull loaded with incorrect type" )
775
+
758
776
759
777
class TestPostgreSQLAlchemy (_TestSQLAlchemy ):
760
778
flavor = 'postgresql'
0 commit comments