Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Add find replace test#3630

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
takluyver merged 6 commits intojupyter:masterfromarovit:add_find_replace_test
Jun 10, 2018
Merged
Show file tree
Hide file tree
Changes from1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
NextNext commit
[WIP] [3335] Converting prompt_numbers.js test to selenium
  • Loading branch information
arovitn committedApr 21, 2018
commitce7a568ab7d9e0527a7035110956b2a4ea0add1e
28 changes: 28 additions & 0 deletionsnotebook/tests/selenium/test_prompt_numbers.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
import os
import pytest
import time

# selenium test version for 'prompt_numbers.js'

def get_prompt(nb, index):
cell = nb.cells[0]
return cell.find_element_by_class_name('input').find_element_by_class_name('input_prompt').get_attribute('innerHTML').strip()

def set_prompt(nb, index, value):
nb.set_cell_input_prompt(index, value)

def test_prompt_numbers(notebook):
cell_index = 0
a = 'print("a")'
notebook.edit_cell(index=cell_index, content=a)
assert get_prompt(notebook, cell_index) == "<bdi>In</bdi>&nbsp;[&nbsp;]:"
set_prompt(notebook, cell_index, 2);
assert get_prompt(notebook, cell_index) == "<bdi>In</bdi>&nbsp;[2]:"
set_prompt(notebook, cell_index, 0);
assert get_prompt(notebook, cell_index) == "<bdi>In</bdi>&nbsp;[0]:"
set_prompt(notebook, cell_index, "'*'");
assert get_prompt(notebook, cell_index) == "<bdi>In</bdi>&nbsp;[*]:"
set_prompt(notebook, cell_index, "undefined");
assert get_prompt(notebook, cell_index) == "<bdi>In</bdi>&nbsp;[&nbsp;]:"
set_prompt(notebook, cell_index, "null");
assert get_prompt(notebook, cell_index) == "<bdi>In</bdi>&nbsp;[&nbsp;]:"
4 changes: 4 additions & 0 deletionsnotebook/tests/selenium/utils.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -135,6 +135,10 @@ def set_cell_metadata(self, index, key, value):
JS = 'Jupyter.notebook.get_cell({}).metadata.{} = {}'.format(index, key, value)
return self.browser.execute_script(JS)

def set_cell_input_prompt(self, index, prmpt_val):
JS = 'Jupyter.notebook.get_cell({}).set_input_prompt({})'.format(index, prmpt_val)
self.browser.execute_script(JS)

def edit_cell(self, cell=None, index=0, content="", render=False):
"""Set the contents of a cell to *content*, by cell object or by index
"""
Expand Down

[8]ページ先頭

©2009-2025 Movatter.jp