Skip to content

Commit

Permalink
fix linter, pin mypy version exist code 2, usage has changed
Browse files Browse the repository at this point in the history
  • Loading branch information
agoscinski committed Jul 3, 2024
1 parent 4db9629 commit 42a047d
Show file tree
Hide file tree
Showing 9 changed files with 54 additions and 60 deletions.
6 changes: 2 additions & 4 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
import subprocess
import time
from urllib.parse import urljoin
from packaging.version import Version

import pytest
from packaging.version import Version
from selenium.common.exceptions import StaleElementReferenceException
from selenium.webdriver.common.by import By
from selenium.webdriver.support import expected_conditions
Expand Down Expand Up @@ -115,9 +115,7 @@ def _selenium_driver(nb_path):
"Restart Kernel and Run All Cells…"
)
else:
restart_kernel_button_class_name = (
"jp-ToolbarButtonComponent"
)
restart_kernel_button_class_name = "jp-ToolbarButtonComponent"
restart_kernel_button_title_attribute = (
"Restart the kernel and run all cells"
)
Expand Down
1 change: 0 additions & 1 deletion tests/notebooks/widget_answers.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
from scwidgets.exercise import CodeExercise, ExerciseRegistry, TextExercise

sys.path.insert(0, os.path.abspath("../.."))
print()

# -

Expand Down
2 changes: 0 additions & 2 deletions tests/notebooks/widget_check_registry.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
sys.path.insert(0, os.path.abspath("../.."))
from tests.test_check import mock_checkable_widget # noqa: E402
from tests.test_check import single_param_check # noqa: E402
print()

# -

Expand All @@ -38,7 +37,6 @@ def create_check_registry(use_fingerprint, failing, buggy):
)
_ = mock_checkable_widget(check_registry, check.function_to_check, [check])
return check_registry
print()


# Test 1:
Expand Down
1 change: 0 additions & 1 deletion tests/notebooks/widget_code_exercise.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
sys.path.insert(0, os.path.abspath("../.."))
from tests.test_check import single_param_check # noqa: E402
from tests.test_code import get_code_exercise # noqa: E402
print()

# -

Expand Down
4 changes: 0 additions & 4 deletions tests/notebooks/widget_cue_figure-inline.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,20 +14,16 @@

import matplotlib
import matplotlib.pyplot as plt
print()

from scwidgets.cue import CueFigure
print()


def run_cue_figure():
fig = plt.figure()
return CueFigure(fig)
print()


matplotlib.use("module://matplotlib_inline.backend_inline")
print()


# #### Test 1.1
Expand Down
17 changes: 0 additions & 17 deletions tests/notebooks/widget_cue_figure-ipympl.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,8 @@

import matplotlib
import matplotlib.pyplot as plt
print()

from scwidgets.cue import CueFigure
print()


def run_cue_figure():
Expand All @@ -27,11 +25,9 @@ def run_cue_figure():
fig.canvas.toolbar_visible = False
fig.canvas.resizable = False
return CueFigure(fig)
print()


matplotlib.use("module://ipympl.backend_nbagg")
print()


# #### Test 1.1
Expand All @@ -42,12 +38,10 @@ def run_cue_figure():

# just checks if no error is raised when no axes is present
cf.clear_figure()
print()

# Tests if plots are properly closed inside the CueFigure
# so the output in this celll should be empty
plt.show()
print()

# #### Test 1.2
# Tests if axis is drawn on figure
Expand All @@ -60,16 +54,13 @@ def run_cue_figure():
# axes should be retained using clear_figure
cf.clear_figure()
cf.draw_display()
print()

# Tests if plots are properly closed inside the CueFigure
# so the output in this celll should be empty
plt.show()
print()

# +
# cf.figure.savefig("../screenshots/widget_cue_figure/empty_axis.png")
print()
# -

# #### Test 1.3
Expand All @@ -81,17 +72,14 @@ def run_cue_figure():
ax = cf.figure.gca()
ax.plot([0, 0.5], [0, 0.5])
cf.draw_display()
print()

# Tests if plots are properly closed
plt.show()
print()


# +
# screenshot for references
# cf.figure.savefig("../screenshots/widget_cue_figure/update_figure_plot.png")
print()
# -

# #### Test 1.4
Expand All @@ -113,17 +101,14 @@ def update_figure(cf, x, y):
cf.clear_display()
update_figure(cf, [0, 0.5], [0, 0.5])
cf.draw_display()
print()

# Tests if plots are properly closed
plt.show()
print()


# +
# screenshot for references
# cf.figure.savefig("../screenshots/widget_cue_figure/update_figure_set.png")
print()
# -

# #### Test 1.5
Expand All @@ -142,8 +127,6 @@ def update_figure(cf, x, y):
cf.clear_display()
update_figure(cf, [0, 0.5], [0, 0.5])
cf.draw_display()
print()

# Tests if plots are properly closed
plt.show()
print()
4 changes: 0 additions & 4 deletions tests/notebooks/widgets_cue.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,9 @@

# +
from ipywidgets import Text, VBox
print()

import scwidgets
from scwidgets.cue import CheckCueBox, CueBox, ResetCueButton, SaveCueBox, UpdateCueBox
print()

scwidgets.get_css_style()
# -
Expand All @@ -33,7 +31,6 @@ def create_cue_box(CueBoxClass, cued):
text_input = Text("Text")
cued_text_input = CueBoxClass(text_input, cued=cued)
return cued_text_input
print()


# Test 1.1
Expand Down Expand Up @@ -82,7 +79,6 @@ def action():
reset_cue_button.set_cue_widgets([cue_unused_text_input])
reset_cue_button.set_cue_widgets([cue_text_input, cue_reset_cue_button])
return VBox([cue_text_input, cue_unused_text_input, cue_reset_cue_button])
print()


# Test 2.1
Expand Down
Loading

0 comments on commit 42a047d

Please sign in to comment.