Skip to content

removing old redundant code that yields SettingWithCopyWarning, remove depracated inplace, and fix hanging tests #88

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

Merged
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
9 changes: 1 addition & 8 deletions gspread_pandas/util.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import warnings
from distutils.version import StrictVersion
from re import match
from time import sleep

Expand Down Expand Up @@ -217,13 +216,7 @@ def fillna(df, fill_value=""):
"""
for col in df.dtypes[df.dtypes == "category"].index:
if fill_value not in df[col].cat.categories:
df[col].cat.add_categories([fill_value], inplace=True)
# Known bug https://github.com/pandas-dev/pandas/issues/25472
if StrictVersion(pd.__version__) >= StrictVersion("1.0"):
for col in df.dtypes[
df.dtypes.apply(lambda x: x in ["float64", "int16"])
].index:
df[col] = df[col].astype("float")
df[col] = df[col].cat.add_categories([fill_value])
return df.fillna(fill_value)


Expand Down
6 changes: 3 additions & 3 deletions tests/conf_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,18 +45,18 @@ def test_oauth_no_key(self, set_oauth_config):
conf.get_creds(user=None)

def test_oauth_first_time(self, mocker, set_oauth_config, creds_json):
mocked = mocker.patch.object(conf.InstalledAppFlow, "run_console")
mocked = mocker.patch.object(conf.InstalledAppFlow, "run_local_server")
mocked.return_value = OAuth2Credentials.from_authorized_user_info(creds_json)
conf.get_creds()
# python 3.5 doesn't have assert_called_once
assert mocked.call_count == 1
assert (conf.get_config_dir() / "creds" / "default").exists()

def test_oauth_first_time_no_save(self, mocker, set_oauth_config):
mocker.patch.object(conf.InstalledAppFlow, "run_console")
mocker.patch.object(conf.InstalledAppFlow, "run_local_server")
conf.get_creds(save=False)
# python 3.5 doesn't have assert_called_once
assert conf.InstalledAppFlow.run_console.call_count == 1
assert conf.InstalledAppFlow.run_local_server.call_count == 1

def test_oauth_default(self, make_creds):
assert isinstance(conf.get_creds(), OAuth2Credentials)
Expand Down