Skip to content

Commit

Permalink
updates to docs and tests
Browse files Browse the repository at this point in the history
  • Loading branch information
andy-esch committed Sep 12, 2017
1 parent 65a8041 commit 6b9a1a8
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
3 changes: 2 additions & 1 deletion cartoframes/context.py
Expand Up @@ -158,7 +158,8 @@ def write(self, df, table_name, temp_dir='/tmp', overwrite=False,
Returns:
:obj:`BatchJobStatus` or None: If `lnglat` flag is set, a
:obj:`BatchJobStatus` instance is returned. Otherwise, None.
:obj:`BatchJobStatus` instance is returned for DataFrames with more
than 100,000 rows. Otherwise, None.
"""
if encode_geom:
_add_encoded_geom(df, geom_col)
Expand Down
12 changes: 7 additions & 5 deletions test/test_context.py
Expand Up @@ -11,7 +11,6 @@
from carto.auth import APIKeyAuthClient
from carto.sql import SQLClient
import pandas as pd
import warnings

WILL_SKIP = False

Expand Down Expand Up @@ -164,7 +163,7 @@ def test_cartocontext_write(self):
FROM {table}
LIMIT 0
'''.format(table=self.test_write_table))
self.assertTrue(resp is not None)
self.assertIsNotNone(resp)

# check that table has same number of rows
resp = self.sql_client.send('''
Expand Down Expand Up @@ -225,16 +224,19 @@ def test_cartocontext_delete(self):
"""CartoContext.delete"""
cc = cartoframes.CartoContext(base_url=self.baseurl,
api_key=self.apikey)
data = {'col1': [1,2,3],
'col2': ['a','b','c']}
data = {'col1': [1, 2, 3],
'col2': ['a', 'b', 'c']}
df = pd.DataFrame(data)

cc.write(df, self.test_delete_table)
cc.delete(self.test_delete_table)

# check that querying recently deleted table raises an exception
with self.assertRaises(CartoException):
cc.sql_client.send('select * from {}'.format(self.test_delete_table))
cc.sql_client.send('''
SELECT *
FROM {}
'''.format(self.test_delete_table))

# try to delete a table that does not exists
with warnings.catch_warnings(record=True) as w:
Expand Down

0 comments on commit 6b9a1a8

Please sign in to comment.