Skip to content

Commit 85ebe5c

Browse files
[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
1 parent c2fe3ee commit 85ebe5c

26 files changed

+178
-106
lines changed

pytest_notebook/__init__.py

Lines changed: 1 addition & 0 deletions
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

Lines changed: 1 addition & 0 deletions
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

Lines changed: 2 additions & 3 deletions
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

Lines changed: 3 additions & 5 deletions
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

Lines changed: 3 additions & 5 deletions
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

Lines changed: 10 additions & 6 deletions
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

Lines changed: 3 additions & 3 deletions
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
@@ -177,8 +178,7 @@ class CoverageError(Exception):
177178
def from_exec_reply(cls, phase, reply):
178179
"""Instantiate from an execution reply."""
179180
return cls(
180-
f"An error occurred while executing coverage {phase}:\n"
181-
f"{reply['content']}"
181+
f"An error occurred while executing coverage {phase}:\n{reply['content']}"
182182
)
183183

184184
@classmethod
@@ -188,7 +188,7 @@ def from_cell_output(cls, phase, output):
188188
return cls(
189189
f"An error occurred while executing coverage {phase}:\n"
190190
f"{traceback}\n"
191-
f"{output.get('ename', '<Error>')}: { output.get('evalue', '')}"
191+
f"{output.get('ename', '<Error>')}: {output.get('evalue', '')}"
192192
)
193193

194194

pytest_notebook/ipy_magic.py

Lines changed: 2 additions & 1 deletion
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

Lines changed: 1 addition & 0 deletions
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

Lines changed: 1 addition & 0 deletions
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

0 commit comments

Comments
 (0)