Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork8.1k
Convert axis limit units in Qt plot options widget#19677
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Changes from5 commits
6d90ab479f338515764cf25a4eee84c36d17867ce8e347200File filter
Filter by extension
Conversations
Uh oh!
There was an error while loading.Please reload this page.
Jump to
Uh oh!
There was an error while loading.Please reload this page.
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,5 @@ | ||
| import copy | ||
| from datetime import date, datetime | ||
| import signal | ||
| from unittest import mock | ||
| @@ -10,7 +11,8 @@ | ||
| try: | ||
| from matplotlib.backends.qt_compat import QtGui, QtWidgets | ||
| from matplotlib.backends.qt_editor import _formlayout | ||
| except ImportError: | ||
| pytestmark = pytest.mark.skip('No usable Qt5 bindings') | ||
| @@ -258,6 +260,20 @@ def test_figureoptions(): | ||
| fig.canvas.manager.toolbar.edit_parameters() | ||
| @pytest.mark.backend('Qt5Agg', skip_on_importerror=True) | ||
| def test_figureoptions_with_datetime_axes(): | ||
| fig, ax = plt.subplots() | ||
| xydata = [ | ||
| datetime(year=2021, month=1, day=1), | ||
| datetime(year=2021, month=2, day=1) | ||
| ] | ||
| ax.plot(xydata, xydata) | ||
| with mock.patch( | ||
| "matplotlib.backends.qt_editor._formlayout.FormDialog.exec_", | ||
| lambda self: None): | ||
| fig.canvas.manager.toolbar.edit_parameters() | ||
| @pytest.mark.backend('Qt5Agg', skip_on_importerror=True) | ||
| def test_double_resize(): | ||
| # Check that resizing a figure twice keeps the same window size | ||
| @@ -295,3 +311,25 @@ def crashing_callback(fig, stale): | ||
| canvas = FigureCanvasQTAgg(fig) | ||
| fig.stale = True | ||
| assert called | ||
| @pytest.mark.backend('Qt5Agg', skip_on_importerror=True) | ||
| def test_form_widget_get_with_datetime_field(): | ||
| if not QtWidgets.QApplication.instance(): | ||
| QtWidgets.QApplication() | ||
| form = [("Field name", datetime(year=2021, month=3, day=11))] | ||
| widget = _formlayout.FormWidget(form) | ||
| widget.setup() | ||
| values = widget.get() | ||
| assert(values == [datetime(year=2021, month=3, day=11)]) | ||
| ||
| @pytest.mark.backend('Qt5Agg', skip_on_importerror=True) | ||
| def test_form_widget_get_with_date_field(): | ||
| ||
| if not QtWidgets.QApplication.instance(): | ||
| QtWidgets.QApplication() | ||
| form = [("Field name", date(year=2021, month=3, day=11))] | ||
| widget = _formlayout.FormWidget(form) | ||
| widget.setup() | ||
| values = widget.get() | ||
| assert(values == [date(year=2021, month=3, day=11)]) | ||