Skip to content

Commit 533e198

Browse files
committed
Merge branch 'master' of https://github.com/jupyter/notebook into list_hidden_files
2 parents 48915c0 + 7ded638 commit 533e198

File tree

6 files changed

+72
-104
lines changed

6 files changed

+72
-104
lines changed

.gitignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ __pycache__
2727
\#*#
2828
.#*
2929
.coverage
30+
.pytest_cache
3031
src
3132

3233
*.swp
@@ -38,4 +39,5 @@ config.rst
3839
/.project
3940
/.pydevproject
4041

41-
package-lock.json
42+
package-lock.json
43+
geckodriver.log

.travis.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,11 @@ before_install:
3636
- |
3737
if [[ $GROUP == docs ]]; then
3838
pip install -r docs/doc-requirements.txt
39+
pip install --upgrade pytest
3940
fi
4041
- |
4142
if [[ $GROUP == selenium ]]; then
42-
pip install selenium
43+
pip install --upgrade selenium pytest
4344
# Install Webdriver backend for Firefox:
4445
wget https://github.com/mozilla/geckodriver/releases/download/v0.19.1/geckodriver-v0.19.1-linux64.tar.gz
4546
mkdir geckodriver

docs/source/examples/Notebook/Running Code.ipynb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
"cell_type": "markdown",
1212
"metadata": {},
1313
"source": [
14-
"First and foremost, the Jupyter Notebook is an interactive environment for writing and running code. The notebook is capable of running code in a wide range of languages. However, each notebook is associated with a single kernel. This notebook is associated with the IPython kernel, therefor runs Python code."
14+
"First and foremost, the Jupyter Notebook is an interactive environment for writing and running code. The notebook is capable of running code in a wide range of languages. However, each notebook is associated with a single kernel. This notebook is associated with the IPython kernel, therefore runs Python code."
1515
]
1616
},
1717
{

notebook/tests/notebook/multiselect.js

Lines changed: 0 additions & 100 deletions
This file was deleted.
Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
def test_multiselect(notebook):
2+
def extend_selection_by(delta):
3+
notebook.browser.execute_script(
4+
"Jupyter.notebook.extend_selection_by(arguments[0]);", delta)
5+
6+
def n_selected_cells():
7+
return notebook.browser.execute_script(
8+
"return Jupyter.notebook.get_selected_cells().length;")
9+
10+
a = 'print("a")'
11+
b = 'print("b")'
12+
c = 'print("c")'
13+
notebook.edit_cell(index=0, content=a)
14+
notebook.append(b, c)
15+
16+
notebook.focus_cell(0)
17+
assert n_selected_cells() == 1
18+
19+
# Check that only one cell is selected according to CSS classes as well
20+
selected_css = notebook.browser.find_elements_by_css_selector(
21+
'.cell.jupyter-soft-selected, .cell.selected')
22+
assert len(selected_css) == 1
23+
24+
# Extend the selection down one
25+
extend_selection_by(1)
26+
assert n_selected_cells() == 2
27+
28+
# Contract the selection up one
29+
extend_selection_by(-1)
30+
assert n_selected_cells() == 1
31+
32+
# Extend the selection up one
33+
notebook.focus_cell(1)
34+
extend_selection_by(-1)
35+
assert n_selected_cells() == 2
36+
37+
# Convert selected cells to Markdown
38+
notebook.browser.execute_script("Jupyter.notebook.cells_to_markdown();")
39+
cell_types = notebook.browser.execute_script(
40+
"return Jupyter.notebook.get_cells().map(c => c.cell_type)")
41+
assert cell_types == ['markdown', 'markdown', 'code']
42+
# One cell left selected after conversion
43+
assert n_selected_cells() == 1
44+
45+
# Convert selected cells to raw
46+
notebook.focus_cell(1)
47+
extend_selection_by(1)
48+
assert n_selected_cells() == 2
49+
notebook.browser.execute_script("Jupyter.notebook.cells_to_raw();")
50+
cell_types = notebook.browser.execute_script(
51+
"return Jupyter.notebook.get_cells().map(c => c.cell_type)")
52+
assert cell_types == ['markdown', 'raw', 'raw']
53+
# One cell left selected after conversion
54+
assert n_selected_cells() == 1
55+
56+
# Convert selected cells to code
57+
notebook.focus_cell(0)
58+
extend_selection_by(2)
59+
assert n_selected_cells() == 3
60+
notebook.browser.execute_script("Jupyter.notebook.cells_to_code();")
61+
cell_types = notebook.browser.execute_script(
62+
"return Jupyter.notebook.get_cells().map(c => c.cell_type)")
63+
assert cell_types == ['code'] * 3
64+
# One cell left selected after conversion
65+
assert n_selected_cells() == 1

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@
9898
zip_safe = False,
9999
install_requires = [
100100
'jinja2',
101-
'tornado>=4',
101+
'tornado>=4, <6',
102102
# pyzmq>=17 is not technically necessary,
103103
# but hopefully avoids incompatibilities with Tornado 5. April 2018
104104
'pyzmq>=17',

0 commit comments

Comments
 (0)