Skip to content

Commit 9c3c136

Browse files
[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
1 parent 631e929 commit 9c3c136

26 files changed

+176
-103
lines changed

pytest_notebook/__init__.py

+1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
"""A pytest plugin for testing Jupyter Notebooks."""
2+
23
__version__ = "0.10.0"

pytest_notebook/diffing.py

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
"""Diffing of notebooks."""
2+
23
import copy
34
import operator
45
import re

pytest_notebook/example_nbs/coverage.ipynb

+2-3
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,9 @@
1414
}
1515
],
1616
"source": [
17-
"\n",
1817
"from pytest_notebook import __version__\n",
19-
"from pytest_notebook.notebook import create_notebook\n",
20-
"print(__version__)\n"
18+
"\n",
19+
"print(__version__)"
2120
]
2221
}
2322
],

pytest_notebook/example_nbs/example1.ipynb

+3-5
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,7 @@
1212
"execution_count": 2,
1313
"metadata": {},
1414
"outputs": [],
15-
"source": [
16-
"from IPython import display"
17-
]
15+
"source": []
1816
},
1917
{
2018
"cell_type": "code",
@@ -31,8 +29,8 @@
3129
}
3230
],
3331
"source": [
34-
"print('hallo1')\n",
35-
"print('hallo2')"
32+
"print(\"hallo1\")\n",
33+
"print(\"hallo2\")"
3634
]
3735
}
3836
],

pytest_notebook/example_nbs/example1_pass.ipynb

+3-5
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,7 @@
1212
"execution_count": 1,
1313
"metadata": {},
1414
"outputs": [],
15-
"source": [
16-
"from IPython import display"
17-
]
15+
"source": []
1816
},
1917
{
2018
"cell_type": "code",
@@ -31,8 +29,8 @@
3129
}
3230
],
3331
"source": [
34-
"print('hallo1')\n",
35-
"print('hallo2')"
32+
"print(\"hallo1\")\n",
33+
"print(\"hallo2\")"
3634
]
3735
}
3836
],

pytest_notebook/example_nbs/example2.ipynb

+10-6
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,8 @@
3131
}
3232
],
3333
"source": [
34-
"print('hallo1')\n",
35-
"print('hallo2')"
34+
"print(\"hallo1\")\n",
35+
"print(\"hallo2\")"
3636
]
3737
},
3838
{
@@ -118,7 +118,7 @@
118118
],
119119
"source": [
120120
"# code cell + png\n",
121-
"display.Image(filename='128x128.png', width=200, unconfined=True)"
121+
"display.Image(filename=\"128x128.png\", width=200, unconfined=True)"
122122
]
123123
},
124124
{
@@ -145,7 +145,7 @@
145145
],
146146
"source": [
147147
"# code cell + jpg\n",
148-
"display.Image(filename='128x128.jpg', width=200, unconfined=True)"
148+
"display.Image(filename=\"128x128.jpg\", width=200, unconfined=True)"
149149
]
150150
},
151151
{
@@ -178,9 +178,13 @@
178178
}
179179
],
180180
"source": [
181-
"print('before exception')\n",
181+
"print(\"before exception\")\n",
182+
"\n",
183+
"\n",
182184
"def func(b):\n",
183-
" raise ValueError('there was an error')\n",
185+
" raise ValueError(\"there was an error\")\n",
186+
"\n",
187+
"\n",
184188
"for i in range(10):\n",
185189
" func(i)"
186190
]

pytest_notebook/execution.py

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
"""Execution of notebooks."""
2+
23
from contextlib import nullcontext
34
import copy
45
import json

pytest_notebook/ipy_magic.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
then ``%pytest`` and ``%%pytest`` can be accessed.
55
66
"""
7+
78
# TODO post solution to stackoverflow:
89
# https://stackoverflow.com/questions/41304311/running-pytest-test-functions-inside-a-jupyter-notebook
910
import os
@@ -20,7 +21,7 @@
2021

2122

2223
def parse_cell_content(
23-
cell: Union[str, None]
24+
cell: Union[str, None],
2425
) -> Tuple[List[str], List[str], List[str]]:
2526
"""Parse the cell contents.
2627

pytest_notebook/nb_regression.py

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
"""Jupyter Notebook Regression Test Class."""
2+
23
import copy
34
import logging
45
import os

pytest_notebook/notebook.py

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
"""Module for working with notebook."""
2+
23
import copy
34
from functools import lru_cache
45

pytest_notebook/plugin.py

+1
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
- https://docs.pytest.org/en/latest/_modules/_pytest/hookspec.html
1111
1212
"""
13+
1314
import os
1415
import shlex
1516

pytest_notebook/post_processors.py

+1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
All functions should take (notebook, resources) as input,
44
and output a (new notebook, resources).
55
"""
6+
67
import copy
78
import functools
89
import logging

pytest_notebook/utils.py

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
"""Utility functions."""
2+
23
import os
34
import textwrap
45
import warnings

tests/raw_files/coverage_test/call_package.ipynb

+1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
"outputs": [],
88
"source": [
99
"import package\n",
10+
"\n",
1011
"package.func()"
1112
]
1213
}

tests/raw_files/different_outputs.ipynb

+32-17
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
"source": [
2121
"# code cell, no output\n",
2222
"import sys\n",
23+
"\n",
2324
"from IPython import display"
2425
]
2526
},
@@ -38,7 +39,7 @@
3839
],
3940
"source": [
4041
"# code cell + stdout\n",
41-
"print('hallo')"
42+
"print(\"hallo\")"
4243
]
4344
},
4445
{
@@ -57,8 +58,8 @@
5758
],
5859
"source": [
5960
"# code cell + stdout + stdout\n",
60-
"print('hallo1')\n",
61-
"print('hallo2')"
61+
"print(\"hallo1\")\n",
62+
"print(\"hallo2\")"
6263
]
6364
},
6465
{
@@ -76,7 +77,7 @@
7677
],
7778
"source": [
7879
"# code cell + stderr\n",
79-
"print('hallo', file=sys.stderr)"
80+
"print(\"hallo\", file=sys.stderr)"
8081
]
8182
},
8283
{
@@ -101,8 +102,8 @@
101102
],
102103
"source": [
103104
"# code cell + stderr + stdout\n",
104-
"print('hallo1', file=sys.stderr)\n",
105-
"print('hallo2')"
105+
"print(\"hallo1\", file=sys.stderr)\n",
106+
"print(\"hallo2\")"
106107
]
107108
},
108109
{
@@ -126,7 +127,7 @@
126127
],
127128
"source": [
128129
"# code cell + latex\n",
129-
"display.Latex('\\\\textit{hallo}')"
130+
"display.Latex(\"\\\\textit{hallo}\")"
130131
]
131132
},
132133
{
@@ -194,7 +195,17 @@
194195
],
195196
"source": [
196197
"# code cell + json\n",
197-
"display.JSON({'a': [1, 2, 3, 4,], 'b': {'inner1': 'helloworld', 'inner2': 'foobar'}})"
198+
"display.JSON(\n",
199+
" {\n",
200+
" \"a\": [\n",
201+
" 1,\n",
202+
" 2,\n",
203+
" 3,\n",
204+
" 4,\n",
205+
" ],\n",
206+
" \"b\": {\"inner1\": \"helloworld\", \"inner2\": \"foobar\"},\n",
207+
" }\n",
208+
")"
198209
]
199210
},
200211
{
@@ -220,7 +231,7 @@
220231
],
221232
"source": [
222233
"# code cell + markdown\n",
223-
"display.Markdown('## Header\\n\\n- bullet')"
234+
"display.Markdown(\"## Header\\n\\n- bullet\")"
224235
]
225236
},
226237
{
@@ -300,7 +311,7 @@
300311
],
301312
"source": [
302313
"# code cell + png\n",
303-
"display.Image(filename='128x128.png', width=200, unconfined=True)"
314+
"display.Image(filename=\"128x128.png\", width=200, unconfined=True)"
304315
]
305316
},
306317
{
@@ -327,7 +338,7 @@
327338
],
328339
"source": [
329340
"# code cell + jpg\n",
330-
"display.Image(filename='128x128.jpg', width=200, unconfined=True)"
341+
"display.Image(filename=\"128x128.jpg\", width=200, unconfined=True)"
331342
]
332343
},
333344
{
@@ -381,10 +392,10 @@
381392
}
382393
],
383394
"source": [
384-
"display.display(display.Image(filename='128x128.png', width=200, unconfined=False))\n",
385-
"print('hallo1', file=sys.stderr)\n",
386-
"print('hallo2')\n",
387-
"display.Image(filename='128x128.jpg', width=200, unconfined=True)"
395+
"display.display(display.Image(filename=\"128x128.png\", width=200, unconfined=False))\n",
396+
"print(\"hallo1\", file=sys.stderr)\n",
397+
"print(\"hallo2\")\n",
398+
"display.Image(filename=\"128x128.jpg\", width=200, unconfined=True)"
388399
]
389400
},
390401
{
@@ -417,9 +428,13 @@
417428
}
418429
],
419430
"source": [
420-
"print('before exception')\n",
431+
"print(\"before exception\")\n",
432+
"\n",
433+
"\n",
421434
"def func(b):\n",
422-
" raise ValueError('there was an error')\n",
435+
" raise ValueError(\"there was an error\")\n",
436+
"\n",
437+
"\n",
423438
"for i in range(10):\n",
424439
" func(i)"
425440
]

0 commit comments

Comments
 (0)