Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TST: enable MySQL tests #6613

Merged
merged 1 commit into from
Mar 12, 2014
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions ci/requirements-2.7.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,5 @@ beautifulsoup4==4.2.1
statsmodels==0.5.0
bigquery==2.0.17
sqlalchemy==0.8.1
pymysql==0.6.1
psycopg2==2.5.2
1 change: 1 addition & 0 deletions ci/requirements-3.3.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,5 @@ scipy==0.12.0
beautifulsoup4==4.2.1
statsmodels==0.4.3
sqlalchemy==0.9.1
pymysql==0.6.1
psycopg2==2.5.2
2 changes: 1 addition & 1 deletion pandas/io/sql.py
Original file line number Diff line number Diff line change
Expand Up @@ -668,7 +668,7 @@ def read_table(self, table_name, index_col=None, coerce_float=True,
parse_dates=None, columns=None):

table = PandasSQLTable(table_name, self, index=index_col)
return table.read(coerce_float=parse_dates,
return table.read(coerce_float=coerce_float,
parse_dates=parse_dates, columns=columns)

def drop_table(self, table_name):
Expand Down
22 changes: 20 additions & 2 deletions pandas/io/tests/test_sql.py
Original file line number Diff line number Diff line change
Expand Up @@ -495,7 +495,7 @@ def test_read_table_absent(self):
self.assertRaises(
ValueError, sql.read_table, "this_doesnt_exist", con=self.conn)

def test_default_type_convertion(self):
def test_default_type_conversion(self):
df = sql.read_table("types_test_data", self.conn)

self.assertTrue(issubclass(df.FloatCol.dtype.type, np.floating),
Expand Down Expand Up @@ -589,7 +589,7 @@ def setUp(self):

self._load_test1_data()

def test_default_type_convertion(self):
def test_default_type_conversion(self):
df = sql.read_table("types_test_data", self.conn)

self.assertTrue(issubclass(df.FloatCol.dtype.type, np.floating),
Expand Down Expand Up @@ -755,6 +755,24 @@ def tearDown(self):
for table in c.fetchall():
self.conn.execute('DROP TABLE %s' % table[0])

def test_default_type_conversion(self):
df = sql.read_table("types_test_data", self.conn)

self.assertTrue(issubclass(df.FloatCol.dtype.type, np.floating),
"FloatCol loaded with incorrect type")
self.assertTrue(issubclass(df.IntCol.dtype.type, np.integer),
"IntCol loaded with incorrect type")
# MySQL has no real BOOL type (it's an alias for TINYINT)
self.assertTrue(issubclass(df.BoolCol.dtype.type, np.integer),
"BoolCol loaded with incorrect type")

# Int column with NA values stays as float
self.assertTrue(issubclass(df.IntColWithNull.dtype.type, np.floating),
"IntColWithNull loaded with incorrect type")
# Bool column with NA = int column with NA values => becomes float
self.assertTrue(issubclass(df.BoolColWithNull.dtype.type, np.floating),
"BoolColWithNull loaded with incorrect type")


class TestPostgreSQLAlchemy(_TestSQLAlchemy):
flavor = 'postgresql'
Expand Down