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

CLN: Exception in io/plotting #28720

Merged
merged 1 commit into from
Oct 1, 2019
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
13 changes: 5 additions & 8 deletions pandas/plotting/_matplotlib/tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,11 @@

def format_date_labels(ax, rot):
# mini version of autofmt_xdate
try:
for label in ax.get_xticklabels():
label.set_ha("right")
label.set_rotation(rot)
fig = ax.get_figure()
fig.subplots_adjust(bottom=0.2)
except Exception: # pragma: no cover
pass
for label in ax.get_xticklabels():
label.set_ha("right")
label.set_rotation(rot)
fig = ax.get_figure()
fig.subplots_adjust(bottom=0.2)


def table(ax, data, rowLabels=None, colLabels=None, **kwargs):
Expand Down
7 changes: 5 additions & 2 deletions pandas/tests/io/test_sql.py
Original file line number Diff line number Diff line change
Expand Up @@ -539,13 +539,16 @@ def _transaction_test(self):
with self.pandasSQL.run_transaction() as trans:
trans.execute("CREATE TABLE test_trans (A INT, B TEXT)")

class DummyException(Exception):
pass

# Make sure when transaction is rolled back, no rows get inserted
ins_sql = "INSERT INTO test_trans (A,B) VALUES (1, 'blah')"
try:
with self.pandasSQL.run_transaction() as trans:
trans.execute(ins_sql)
raise Exception("error")
except Exception:
raise DummyException("error")
except DummyException:
# ignore raised exception
pass
res = self.pandasSQL.read_query("SELECT * FROM test_trans")
Expand Down
2 changes: 1 addition & 1 deletion pandas/tests/plotting/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -536,7 +536,7 @@ def _check_plot_works(f, filterwarnings="always", **kwargs):

plt.clf()

ax = kwargs.get("ax", fig.add_subplot(211)) # noqa
kwargs.get("ax", fig.add_subplot(211))
ret = f(**kwargs)

assert_is_valid_plot_return_object(ret)
Expand Down
9 changes: 3 additions & 6 deletions pandas/tests/plotting/test_datetimelike.py
Original file line number Diff line number Diff line change
Expand Up @@ -1553,12 +1553,9 @@ def _check_plot_works(f, freq=None, series=None, *args, **kwargs):
assert ax.freq == freq

ax = fig.add_subplot(212)
try:
kwargs["ax"] = ax
ret = f(*args, **kwargs)
assert ret is not None # do something more intelligent
except Exception:
pass
kwargs["ax"] = ax
ret = f(*args, **kwargs)
assert ret is not None # TODO: do something more intelligent

with ensure_clean(return_filelike=True) as path:
plt.savefig(path)
Expand Down