Skip to content

Commit f7a22bb

Browse files
committed
tests: fix linting and typing errors
1 parent a13c2f5 commit f7a22bb

File tree

3 files changed

+12
-13
lines changed

3 files changed

+12
-13
lines changed

tests/python/test_jsmodules.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,30 +10,30 @@
1010

1111
class TestJsModules:
1212
def test_js_modules(self):
13-
assert js_modules.d3.bar() == {
13+
assert js_modules.d3.bar() == { # type: ignore
1414
"pyobsplot-type": "function",
1515
"module": "d3",
1616
"method": "bar",
1717
"args": (),
1818
}
19-
assert js_modules.Math.baz() == {
19+
assert js_modules.Math.baz() == { # type: ignore
2020
"pyobsplot-type": "function",
2121
"module": "Math",
2222
"method": "baz",
2323
"args": (),
2424
}
25-
assert js_modules.Math.baz() == {
25+
assert js_modules.Math.baz() == { # type: ignore
2626
"pyobsplot-type": "function",
2727
"module": "Math",
2828
"method": "baz",
2929
"args": (),
3030
}
3131

3232
def test_js_modules_kwargs(self):
33-
with pytest.raises(ValueError, match="kwargs must not be passed to d3\\.foo.*"):
34-
js_modules.d3.foo(x=1)
35-
with pytest.raises(ValueError, match="kwargs must not be passed to d3\\.bar.*"):
36-
js_modules.d3.bar(12, x=1)
33+
with pytest.raises(ValueError, match=r"kwargs must not be passed to d3\.foo.*"):
34+
js_modules.d3.foo(x=1) # type: ignore
35+
with pytest.raises(ValueError, match=r"kwargs must not be passed to d3\.bar.*"):
36+
js_modules.d3.bar(12, x=1) # type: ignore
3737

3838
def test_js(self):
3939
assert js("d => d.foo") == {

tests/python/test_obsplot.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ def test_jsdom_server(self, oj):
167167
assert r.status_code == 200
168168
assert (
169169
r.content.decode()
170-
== '<pre style="color: rgb(221, 51, 51); padding: .5em 1em;">⚠ Error: must specify x or y</pre>' # noqa: E501
170+
== '<pre style="color: rgb(221, 51, 51); padding: .5em 1em;">⚠ Error: must specify x or y</pre>'
171171
)
172172

173173
# bad /plot request
@@ -204,8 +204,7 @@ def test_path_invalid_widget_extension(self, op):
204204

205205
def test_path_html_warning(self, op):
206206
html_warning = (
207-
"Exporting widget to HTML. If you want "
208-
"to output to a static HTML file, add format='html'"
207+
"Exporting widget to HTML. If you want to output to a static HTML file, add format='html'"
209208
)
210209
file_path = tempfile.NamedTemporaryFile(suffix=".html")
211210
with pytest.warns(match=html_warning):

tests/python/test_parsing.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -183,20 +183,20 @@ def test_parse_js(self):
183183
"method": "dot",
184184
"args": [],
185185
}
186-
assert SpecParser().parse(js_modules.d3.bar(1, "baz")) == {
186+
assert SpecParser().parse(js_modules.d3.bar(1, "baz")) == { # type: ignore
187187
"pyobsplot-type": "function",
188188
"module": "d3",
189189
"method": "bar",
190190
"args": [1, "baz"],
191191
}
192-
assert SpecParser().parse(js_modules.Math.random) == {
192+
assert SpecParser().parse(js_modules.Math.random) == { # type: ignore
193193
"pyobsplot-type": "function-object",
194194
"module": "Math",
195195
"method": "random",
196196
"args": (),
197197
}
198198
with pytest.raises(ValueError):
199-
SpecParser().parse(js_modules.d3.bar(1, x="baz"))
199+
SpecParser().parse(js_modules.d3.bar(1, x="baz")) # type: ignore
200200
assert SpecParser().parse(js("d => d.foo")) == {
201201
"pyobsplot-type": "js",
202202
"value": "d => d.foo",

0 commit comments

Comments
 (0)