Repository: CartoDB/cartoframes
Pull request #1354 (2019-12-12 15:08:42)

Release v1.0b7


Patch:
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 6814a9d0..4d91d262 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -5,6 +5,32 @@ All notable changes to this project will be documented in this file.
 The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
 and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
 
+## [1.0b7] - 2019-12-13
+### Added
+- Add logger (#1328)
+- Add source_col param in Isolines (#1303, #1336)
+
+### Changed
+- Improve CartoDataFrame docs (#1307, #1308)
+- Do not return cartodb_id in Geocoding/Isolines (#1302)
+- Improve installation instruction guide (#1322)
+- Publish privacy enhancements (#1286)
+- Check if_exists param options (#1325)
+- Improve download OpenData (#1309)
+- Update DO endpoint (#1311, #1353)
+- Improve DO download performance (#1281)
+- Update quickstart (#1335, #1351)
+
+### Fixed
+- Fix Map default_legend param (#1191)
+- Fix column names normalization (#1304)
+- Review reference/guides copies (#1299, #1321)
+- Display message when Dataset summary is not available (#1208)
+- Fix DataObsClient (#1319)
+- Fix CartoDataFrame plot (#1339)
+- Fix enrichment without subscriptions (#1314)
+- Fix encoding detection with all Nones (#1346) 
+
 ## [1.0b6] - 2019-12-02
 ### Added
 - Add new properties in Catalog Dataset and Geography (#1209)
diff --git a/README.rst b/README.rst
index 1535a3ad..11f7f56f 100644
--- a/README.rst
+++ b/README.rst
@@ -4,8 +4,8 @@ CARTOframes
 
 .. image:: https://travis-ci.org/CartoDB/cartoframes.svg
     :target: https://travis-ci.org/CartoDB/CARTOframes
-.. image:: https://img.shields.io/badge/pypi-v1.0b6-orange
-    :target: https://pypi.org/project/cartoframes/1.0b6
+.. image:: https://img.shields.io/badge/pypi-v1.0b7-orange
+    :target: https://pypi.org/project/cartoframes/1.0b7
 
 A Python package for integrating `CARTO <https://carto.com/>`__ maps, analysis, and data services into data science workflows.
 
@@ -15,14 +15,14 @@ Try it Out
 ==========
 
 * Stable (v0.10.1): |stable|
-* Beta (v1.0b6): |beta|
+* Beta (v1.0b7): |beta|
 * Latest (develop branch): |develop|
 
 .. |stable| image:: https://mybinder.org/badge_logo.svg
     :target: https://mybinder.org/v2/gh/cartodb/cartoframes/v0.10.1?filepath=examples
 
 .. |beta| image:: https://mybinder.org/badge_logo.svg
-    :target: https://mybinder.org/v2/gh/cartodb/cartoframes/v1.0b6?filepath=examples
+    :target: https://mybinder.org/v2/gh/cartodb/cartoframes/v1.0b7?filepath=examples
 
 .. |develop| image:: https://mybinder.org/badge_logo.svg
     :target: https://mybinder.org/v2/gh/cartodb/cartoframes/develop?filepath=examples
@@ -68,11 +68,11 @@ latest version:
 
     $ pip install cartoframes
 
-To install the 1.0b6 beta version:
+To install the 1.0b7 beta version:
 
 .. code:: bash
 
-    $ pip install cartoframes==1.0b6
+    $ pip install cartoframes==1.0b7
 
 `cartoframes` is continuously tested on Python versions 2.7, 3.5, 3.6, and 3.7. It is recommended to use `cartoframes` in Jupyter Notebooks (`pip install jupyter`). See the example usage section below or notebooks in the `examples directory <https://github.com/CartoDB/cartoframes/tree/master/examples>`__ for using `cartoframes` in that environment.
 
diff --git a/binder/requirements.txt b/binder/requirements.txt
index c35c3ea9..12cc44fd 100644
--- a/binder/requirements.txt
+++ b/binder/requirements.txt
@@ -1,4 +1,4 @@
-cartoframes==1.0b6
+cartoframes==1.0b7
 # Additional dependencies from examples
 matplotlib
 dask
diff --git a/cartoframes/_version.py b/cartoframes/_version.py
index 8a9a3648..32be3705 100644
--- a/cartoframes/_version.py
+++ b/cartoframes/_version.py
@@ -1,1 +1,1 @@
-__version__ = '1.0b6'
+__version__ = '1.0b7'
diff --git a/cartoframes/core/logger.py b/cartoframes/core/logger.py
index 537ec445..3da59feb 100644
--- a/cartoframes/core/logger.py
+++ b/cartoframes/core/logger.py
@@ -2,12 +2,16 @@ import sys
 import logging
 
 
-def init_logger():
+def init_logger(formatter):
+    handler = logging.StreamHandler(sys.stdout)
+    handler.setFormatter(logging.Formatter(formatter))
     logging.basicConfig(
-        stream=sys.stdout,
-        format='%(asctime)s - %(levelname)s - %(message)s',
-        level=logging.INFO)
-    return logging.getLogger('CARTOframes')
+        level=logging.INFO,
+        handlers=[handler])
+    return handler, logging.getLogger('CARTOframes')
+
+
+handler, log = init_logger('%(message)s')
 
 
 def set_log_level(level):
@@ -30,7 +34,11 @@ def set_log_level(level):
     if level not in levels:
         return ValueError('Wrong log level. Valid log levels are: critical, error, warning, info, debug, notset.')
 
-    log.setLevel(levels[level])
+    level = levels[level]
 
+    if level == logging.DEBUG:
+        handler.setFormatter(logging.Formatter('%(asctime)s - %(levelname)s - %(message)s'))
+    else:
+        handler.setFormatter(logging.Formatter('%(message)s'))
 
-log = init_logger()
+    log.setLevel(level)
diff --git a/cartoframes/data/clients/bigquery_client.py b/cartoframes/data/clients/bigquery_client.py
index 51a08fed..e05c37b0 100644
--- a/cartoframes/data/clients/bigquery_client.py
+++ b/cartoframes/data/clients/bigquery_client.py
@@ -85,11 +85,7 @@ class BigQueryClient(object):
         self._import_from_GCS_to_BQ(schema, tablename)
 
     @timelogger
-    def download_to_file(self, job, file_path=None, fail_if_exists=False, column_names=None, progress_bar=True):
-        if not file_path:
-            file_name = '{}.csv'.format(job.job_id)
-            file_path = os.path.join(_USER_CONFIG_DIR, file_name)
-
+    def download_to_file(self, job, file_path, fail_if_exists=False, column_names=None, progress_bar=True):
         if fail_if_exists and os.path.isfile(file_path):
             raise CartoException('The file `{}` already exists.'.format(file_path))
 
@@ -101,8 +97,6 @@ class BigQueryClient(object):
 
         _rows_to_file(rows, file_path, column_names, progress_bar)
 
-        return file_path
-
     @timelogger
     def download_to_dataframe(self, job):
         try:
diff --git a/cartoframes/data/observatory/catalog/dataset.py b/cartoframes/data/observatory/catalog/dataset.py
index 2c4a2967..14802785 100644
--- a/cartoframes/data/observatory/catalog/dataset.py
+++ b/cartoframes/data/observatory/catalog/dataset.py
@@ -366,7 +366,7 @@ class Dataset(CatalogEntity):
 
         return cls._entity_repo.get_all(filters, credentials)
 
-    def download(self, credentials=None, file_path=None):
+    def download(self, file_path, credentials=None):
         """Download dataset data as a local file. You need Data Observatory enabled in your CARTO
         account, please contact us at support@carto.com for more information.
 
@@ -374,7 +374,7 @@ class Dataset(CatalogEntity):
         Check the subscription guides for more information.
 
         Args:
-            file_path (str, optional): the file path where save the dataset
+            file_path (str): the file path where save the dataset (CSV).
             credentials (:py:class:`Credentials <cartoframes.auth.Credentials>`, optional):
                 credentials of CARTO user account. If not provided,
                 a default credentials (if set with :py:meth:`set_default_credentials
@@ -389,7 +389,7 @@ class Dataset(CatalogEntity):
         if not self._is_subscribed(credentials):
             raise CartoException('You are not subscribed to this Dataset yet. Please, use the subscribe method first.')
 
-        return self._download(credentials, file_path)
+        self._download(file_path, credentials)
 
     @classmethod
     def get_datasets_spatial_filtered(cls, filter_dataset):
diff --git a/cartoframes/data/observatory/catalog/entity.py b/cartoframes/data/observatory/catalog/entity.py
index 90b8a1d7..18340663 100644
--- a/cartoframes/data/observatory/catalog/entity.py
+++ b/cartoframes/data/observatory/catalog/entity.py
@@ -114,7 +114,7 @@ class CatalogEntity(ABC):
 
         return self.id
 
-    def _download(self, credentials=None, file_path=None):
+    def _download(self, file_path, credentials=None):
         if not self._is_available_in('bq'):
             raise CartoException('{} is not ready for Download. Please, contact us for more information.'.format(self))
 
@@ -134,15 +134,13 @@ class CatalogEntity(ABC):
             query = 'SELECT * FROM `{}`'.format(full_remote_table_name)
             job = bq_client.query(query)
 
-            file_path = bq_client.download_to_file(job, column_names=column_names)
+            bq_client.download_to_file(job, file_path, column_names=column_names)
         except NotFound:
             raise CartoException('You have not purchased the dataset `{}` yet'.format(self.id))
 
         log.info('Data saved: {}.'.format(file_path))
         log.info("To read it you can do: `pandas.read_csv('{}')`.".format(file_path))
 
-        return file_path
-
     def _is_available_in(self, platform=_PLATFORM_BQ):
         return self.data['available_in'] and platform in self.data['available_in']
 
@@ -216,4 +214,13 @@ class CatalogList(list):
                 catalog = Catalog()
                 catalog.categories.to_dataframe()
         """
-        return pd.DataFrame([item.data for item in self])
+
+        df = pd.DataFrame([item.data for item in self])
+
+        if 'available_in' in df:
+            del df['available_in']
+
+        if 'summary_json' in df:
+            del df['summary_json']
+
+        return df
diff --git a/cartoframes/data/observatory/catalog/geography.py b/cartoframes/data/observatory/catalog/geography.py
index 1a73df6d..a98307e3 100644
--- a/cartoframes/data/observatory/catalog/geography.py
+++ b/cartoframes/data/observatory/catalog/geography.py
@@ -200,7 +200,7 @@ class Geography(CatalogEntity):
 
         return cls._entity_repo.get_all(filters, credentials)
 
-    def download(self, credentials=None, file_path=None):
+    def download(self, file_path, credentials=None):
         """Download geography data as a local file. You need Data Observatory enabled in your CARTO
         account, please contact us at support@carto.com for more information.
 
@@ -208,7 +208,7 @@ class Geography(CatalogEntity):
         Check the subscription guides for more information.
 
         Args:
-            file_path (str, optional): the file path where save the dataset
+            file_path (str): the file path where save the dataset (CSV).
             credentials (:py:class:`Credentials <cartoframes.auth.Credentials>`, optional):
                 credentials of CARTO user account. If not provided,
                 a default credentials (if set with :py:meth:`set_default_credentials
@@ -224,7 +224,7 @@ class Geography(CatalogEntity):
             raise CartoException('You are not subscribed to this Geography yet. Please, use the subscribe method '
                                  'first.')
 
-        return self._download(credentials, file_path)
+        return self._download(file_path, credentials)
 
     def subscribe(self, credentials=None):
         """Subscribe to a Geography. You need Data Observatory enabled in your CARTO account, please contact us at
diff --git a/docs/developer-center/guides/02-Installation.md b/docs/developer-center/guides/02-Installation.md
index 54bd1439..54e85791 100644
--- a/docs/developer-center/guides/02-Installation.md
+++ b/docs/developer-center/guides/02-Installation.md
@@ -18,10 +18,10 @@ To install the latest stable version (soon to be deprecated):
 $ pip install cartoframes
 ```
 
-To install a specific version, for example, let's say the 1.0b6 version:
+To install a specific version, for example, let's say the 1.0b7 version:
 
 ```bash
-$ pip install cartoframes==1.0b6
+$ pip install cartoframes==1.0b7
 ```
 
 
@@ -50,7 +50,7 @@ To install a specific version:
 ```bash
 $ virtualenv cartoframes_env
 $ source cartoframes_env/bin/activate
-(cartoframes_env) $ pip install cartoframes==1.0b6
+(cartoframes_env) $ pip install cartoframes==1.0b7
 ```
 
 When the virtual environment is activated, it is visible in the command line prompt, in this case: `(cartoframes_env)`. It can be deactivated by typing `deactivate` to exit the virtualenv:
diff --git a/examples/_debug/do_subscription_ui-form.ipynb b/examples/_debug/do_subscription_ui-form.ipynb
index 65710d66..974b667c 100644
--- a/examples/_debug/do_subscription_ui-form.ipynb
+++ b/examples/_debug/do_subscription_ui-form.ipynb
@@ -19,11 +19,6 @@
    "outputs": [
     {
      "data": {
-      "application/vnd.jupyter.widget-view+json": {
-       "model_id": "85ff89cd96bf472cbf5255f0aa5ac59e",
-       "version_major": 2,
-       "version_minor": 0
-      },
       "text/plain": [
        "HTML(value='\\n<h3>Subscription contract</h3>\\nYou are about to subscribe to <b>%{dataset_name}</b>. The cost o…"
       ]
@@ -33,11 +28,6 @@
     },
     {
      "data": {
-      "application/vnd.jupyter.widget-view+json": {
-       "model_id": "46c18dfd7228439cbe86474dc4cdc579",
-       "version_major": 2,
-       "version_minor": 0
-      },
       "text/plain": [
        "GridspecLayout(children=(Button(button_style='info', description='Yes', layout=Layout(grid_area='widget001', h…"
       ]
@@ -106,11 +96,6 @@
    "outputs": [
     {
      "data": {
-      "application/vnd.jupyter.widget-view+json": {
-       "model_id": "04b75014ebc541b88947516108d17b5d",
-       "version_major": 2,
-       "version_minor": 0
-      },
       "text/plain": [
        "HTML(value='\\n<h3>Subscription contract</h3>\\nYou are about to subscribe to <b>%{dataset_name}</b>. The cost o…"
       ]
@@ -120,11 +105,6 @@
     },
     {
      "data": {
-      "application/vnd.jupyter.widget-view+json": {
-       "model_id": "f0021b1f92a34ffd81af1a3f0562563e",
-       "version_major": 2,
-       "version_minor": 0
-      },
       "text/plain": [
        "GridspecLayout(children=(Button(button_style='info', description='Yes', layout=Layout(grid_area='widget001', h…"
       ]
diff --git a/examples/data_enrichment/enrichment_subscription_workflow.ipynb b/examples/data_enrichment/enrichment_subscription_workflow.ipynb
index 0c77277c..f3705ff0 100644
--- a/examples/data_enrichment/enrichment_subscription_workflow.ipynb
+++ b/examples/data_enrichment/enrichment_subscription_workflow.ipynb
@@ -65,11 +65,6 @@
    "outputs": [
     {
      "data": {
-      "application/vnd.jupyter.widget-view+json": {
-       "model_id": "a298cb65e6024918a36f1bf39aa51edd",
-       "version_major": 2,
-       "version_minor": 0
-      },
       "text/plain": [
        "HTML(value='\\n        <h3>Subscription already purchased</h3>\\n        The dataset <b>carto-do.ags.demographic…"
       ]
@@ -79,7 +74,7 @@
     }
    ],
    "source": [
-    "dataset.subscribe()"
+    "# dataset.subscribe()"
    ]
   },
   {
@@ -89,11 +84,6 @@
    "outputs": [
     {
      "data": {
-      "application/vnd.jupyter.widget-view+json": {
-       "model_id": "206d831ebff64fd8a4be7142286e8ca6",
-       "version_major": 2,
-       "version_minor": 0
-      },
       "text/plain": [
        "HTML(value='\\n        <h3>Subscription already purchased</h3>\\n        The geography <b>carto-do-public-data.u…"
       ]
@@ -103,7 +93,7 @@
     }
    ],
    "source": [
-    "geography.subscribe()"
+    "# geography.subscribe()"
    ]
   },
   {
@@ -1426,7 +1416,7 @@
    "name": "python",
    "nbconvert_exporter": "python",
    "pygments_lexer": "ipython3",
-   "version": "3.6.7"
+   "version": "3.7.4"
   }
  },
  "nbformat": 4,


Test patch:
diff --git a/tests/e2e/data/client/test_bigquery_client.py b/tests/e2e/data/client/test_bigquery_client.py
index 769f385d..a09b2bc4 100644
--- a/tests/e2e/data/client/test_bigquery_client.py
+++ b/tests/e2e/data/client/test_bigquery_client.py
@@ -98,4 +98,4 @@ class TestBigQueryClient(unittest.TestCase):
 
         with open(file_path, 'w'):
             with self.assertRaises(CartoException):
-                bq_client.download_to_file(job, file_path=file_path, fail_if_exists=True, progress_bar=False)
+                bq_client.download_to_file(job, file_path, fail_if_exists=True, progress_bar=False)
diff --git a/tests/unit/data/client/test_bigquery_client.py b/tests/unit/data/client/test_bigquery_client.py
index 19cbaaf6..d43f9477 100644
--- a/tests/unit/data/client/test_bigquery_client.py
+++ b/tests/unit/data/client/test_bigquery_client.py
@@ -54,9 +54,7 @@ class TestBigQueryClient(unittest.TestCase):
 
         bq_client = BigQueryClient(self.credentials)
         job = QueryJobMock(data)
-        file_download = bq_client.download_to_file(job, file_path=file_path, column_names=columns, progress_bar=False)
-
-        assert file_download == file_path
+        bq_client.download_to_file(job, file_path, column_names=columns, progress_bar=False)
 
         rows = []
         with open(file_path) as csvfile:
diff --git a/tests/unit/data/observatory/catalog/mocks.py b/tests/unit/data/observatory/catalog/mocks.py
index 020a1c4d..e561086d 100644
--- a/tests/unit/data/observatory/catalog/mocks.py
+++ b/tests/unit/data/observatory/catalog/mocks.py
@@ -1,6 +1,6 @@
 class BigQueryClientMock(object):
-    def __init__(self, response):
-        self.response = response
+    def __init__(self, exception=None):
+        self.exception = exception
 
         self.bq_public_project = 'public_data_project'
         self.bq_project = 'user_data_project'
@@ -10,11 +10,9 @@ class BigQueryClientMock(object):
     def query(self, _1):
         return True
 
-    def download_to_file(self, _1, column_names=None):
-        if isinstance(self.response, Exception):
-            raise self.response
-        else:
-            return self.response
+    def download_to_file(self, _1, _2, column_names=None):
+        if isinstance(self.exception, Exception):
+            raise self.exception
 
     def get_table_column_names(self, _1, _2, _3):
         return True
diff --git a/tests/unit/data/observatory/catalog/test_dataset.py b/tests/unit/data/observatory/catalog/test_dataset.py
index caf40929..4e44ab5a 100644
--- a/tests/unit/data/observatory/catalog/test_dataset.py
+++ b/tests/unit/data/observatory/catalog/test_dataset.py
@@ -289,6 +289,9 @@ class TestDataset(object):
         # Given
         datasets = test_datasets
         dataset = datasets[0]
+        expected_dataset_df = dataset.to_series()
+        del expected_dataset_df['available_in']
+        del expected_dataset_df['summary_json']
 
         # When
         dataset_df = datasets.to_dataframe()
@@ -297,7 +300,7 @@ class TestDataset(object):
         # Then
         assert isinstance(dataset_df, pd.DataFrame)
         assert isinstance(sliced_dataset, pd.Series)
-        assert sliced_dataset.equals(dataset.to_series())
+        assert sliced_dataset.equals(expected_dataset_df)
 
     @patch.object(DatasetRepository, 'get_all')
     @patch.object(DatasetRepository, 'get_by_id')
@@ -311,15 +314,12 @@ class TestDataset(object):
         get_all_mock.return_value = [dataset]
 
         # mock big query client
-        file_path = 'fake_path'
-        mocked_bq_client.return_value = BigQueryClientMock(file_path)
+        mocked_bq_client.return_value = BigQueryClientMock()
 
         # test
         credentials = Credentials('fake_user', '1234')
 
-        response = dataset.download(credentials)
-
-        assert response == file_path
+        dataset.download('fake_path', credentials)
 
     @patch.object(DatasetRepository, 'get_all')
     @patch.object(DatasetRepository, 'get_by_id')
@@ -333,14 +333,13 @@ class TestDataset(object):
         get_all_mock.return_value = [dataset]
 
         # mock big query client
-        file_path = 'fake_path'
-        mocked_bq_client.return_value = BigQueryClientMock(file_path)
+        mocked_bq_client.return_value = BigQueryClientMock()
 
         # test
         credentials = Credentials('fake_user', '1234')
 
         with pytest.raises(CartoException) as e:
-            dataset.download(credentials)
+            dataset.download('fake_path', credentials)
 
         error = '{} is not ready for Download. Please, contact us for more information.'.format(dataset)
         assert str(e.value) == error
@@ -357,14 +356,13 @@ class TestDataset(object):
         get_all_mock.return_value = []
 
         # mock big query client
-        file_path = 'fake_path'
-        mocked_bq_client.return_value = BigQueryClientMock(file_path)
+        mocked_bq_client.return_value = BigQueryClientMock()
 
         # test
         credentials = Credentials('fake_user', '1234')
 
         with pytest.raises(CartoException) as e:
-            dataset.download(credentials)
+            dataset.download('fake_path', credentials)
 
         error = 'You are not subscribed to this Dataset yet. Please, use the subscribe method first.'
         assert str(e.value) == error
@@ -381,15 +379,12 @@ class TestDataset(object):
         get_all_mock.return_value = []
 
         # mock big query client
-        file_path = 'fake_path'
-        mocked_bq_client.return_value = BigQueryClientMock(file_path)
+        mocked_bq_client.return_value = BigQueryClientMock()
 
         # test
         credentials = Credentials('fake_user', '1234')
 
-        response = dataset.download(credentials)
-
-        assert response == file_path
+        dataset.download('fake_path', credentials)
 
     @patch.object(DatasetRepository, 'get_all')
     @patch.object(DatasetRepository, 'get_by_id')
@@ -409,7 +404,7 @@ class TestDataset(object):
         credentials = Credentials('fake_user', '1234')
 
         with pytest.raises(CartoException):
-            dataset.download(credentials)
+            dataset.download('fake_path', credentials)
 
     @patch('cartoframes.data.observatory.catalog.subscriptions.get_subscription_ids')
     @patch('cartoframes.data.observatory.catalog.utils.display_subscription_form')
diff --git a/tests/unit/data/observatory/catalog/test_geography.py b/tests/unit/data/observatory/catalog/test_geography.py
index bfc2e4bc..6e05cc14 100644
--- a/tests/unit/data/observatory/catalog/test_geography.py
+++ b/tests/unit/data/observatory/catalog/test_geography.py
@@ -215,6 +215,9 @@ class TestGeography(object):
         # Given
         geographies = test_geographies
         geography = geographies[0]
+        expected_geography_df = geography.to_series()
+        del expected_geography_df['available_in']
+        del expected_geography_df['summary_json']
 
         # When
         geography_df = geographies.to_dataframe()
@@ -223,7 +226,7 @@ class TestGeography(object):
         # Then
         assert isinstance(geography_df, pd.DataFrame)
         assert isinstance(sliced_geography, pd.Series)
-        assert sliced_geography.equals(geography.to_series())
+        assert sliced_geography.equals(expected_geography_df)
 
     @patch.object(GeographyRepository, 'get_all')
     @patch.object(GeographyRepository, 'get_by_id')
@@ -237,15 +240,12 @@ class TestGeography(object):
         get_all_mock.return_value = [geography]
 
         # mock big query client
-        file_path = 'fake_path'
-        mocked_bq_client.return_value = BigQueryClientMock(file_path)
+        mocked_bq_client.return_value = BigQueryClientMock()
 
         # test
         credentials = Credentials('fake_user', '1234')
 
-        response = geography.download(credentials)
-
-        assert response == file_path
+        geography.download('fake_path', credentials)
 
     @patch.object(GeographyRepository, 'get_all')
     @patch.object(GeographyRepository, 'get_by_id')
@@ -259,14 +259,13 @@ class TestGeography(object):
         get_all_mock.return_value = [geography]
 
         # mock big query client
-        file_path = 'fake_path'
-        mocked_bq_client.return_value = BigQueryClientMock(file_path)
+        mocked_bq_client.return_value = BigQueryClientMock()
 
         # test
         credentials = Credentials('fake_user', '1234')
 
         with pytest.raises(CartoException) as e:
-            geography.download(credentials)
+            geography.download('fake_path', credentials)
 
         error = '{} is not ready for Download. Please, contact us for more information.'.format(geography)
         assert str(e.value) == error
@@ -283,14 +282,13 @@ class TestGeography(object):
         get_all_mock.return_value = []
 
         # mock big query client
-        file_path = 'fake_path'
-        mocked_bq_client.return_value = BigQueryClientMock(file_path)
+        mocked_bq_client.return_value = BigQueryClientMock()
 
         # test
         credentials = Credentials('fake_user', '1234')
 
         with pytest.raises(CartoException) as e:
-            geography.download(credentials)
+            geography.download('fake_path', credentials)
 
         error = 'You are not subscribed to this Geography yet. Please, use the subscribe method first.'
         assert str(e.value) == error
@@ -307,15 +305,12 @@ class TestGeography(object):
         get_all_mock.return_value = []
 
         # mock big query client
-        file_path = 'fake_path'
-        mocked_bq_client.return_value = BigQueryClientMock(file_path)
+        mocked_bq_client.return_value = BigQueryClientMock()
 
         # test
         credentials = Credentials('fake_user', '1234')
 
-        response = geography.download(credentials)
-
-        assert response == file_path
+        geography.download('fake_path', credentials)
 
     @patch.object(GeographyRepository, 'get_by_id')
     @patch('cartoframes.data.observatory.catalog.entity._get_bigquery_client')
@@ -331,7 +326,7 @@ class TestGeography(object):
 
         geography = Geography.get(test_geography1.id)
         with pytest.raises(CartoException):
-            geography.download(credentials)
+            geography.download('fake_path', credentials)
 
     @patch('cartoframes.data.observatory.catalog.subscriptions.get_subscription_ids')
     @patch('cartoframes.data.observatory.catalog.utils.display_subscription_form')
diff --git a/tests/unit/data/observatory/catalog/test_variable.py b/tests/unit/data/observatory/catalog/test_variable.py
index b5cc1b2f..e2b0bb8a 100644
--- a/tests/unit/data/observatory/catalog/test_variable.py
+++ b/tests/unit/data/observatory/catalog/test_variable.py
@@ -193,6 +193,8 @@ class TestVariable(object):
         # Given
         variables = test_variables
         variable = variables[0]
+        expected_variable_df = variable.to_series()
+        del expected_variable_df['summary_json']
 
         # When
         variable_df = variables.to_dataframe()
@@ -201,4 +203,4 @@ class TestVariable(object):
         # Then
         assert isinstance(variable_df, pd.DataFrame)
         assert isinstance(sliced_variable, pd.Series)
-        assert sliced_variable.equals(variable.to_series())
+        assert sliced_variable.equals(expected_variable_df)