Skip to content
This repository was archived by the owner on Jun 7, 2023. It is now read-only.

Commit e575c17

Browse files
committed
Revert "black"
This reverts commit 152764a.
1 parent 152764a commit e575c17

File tree

2 files changed

+16
-30
lines changed

2 files changed

+16
-30
lines changed

runestone/activecode/test/test_activecode.py

Lines changed: 8 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,7 @@ def click_run(selenium_utils, ac_selenium_element):
1818
rb.click()
1919
# After clicking run, the browser may need some time to load and execute the code. Wait until the run button becomes clickable, indicating the code has finished running.
2020
div_id = ac_selenium_element.get_attribute("id")
21-
selenium_utils.wait.until(EC.element_to_be_clickable(
22-
(By.CSS_SELECTOR, f"#{div_id} .run-button")))
21+
selenium_utils.wait.until(EC.element_to_be_clickable((By.CSS_SELECTOR, f"#{div_id} .run-button")))
2322

2423

2524
def test_hello(selenium_utils_get):
@@ -76,7 +75,7 @@ def test_history(selenium_utils_get):
7675
ta = t1.find_element_by_class_name("cm-s-default")
7776
assert ta
7877
selenium_utils_get.driver.execute_script(
79-
f"""window.componentMap['{div_id}'].editor.setValue("print('Goodbye')")"""
78+
f"""window.edList['{div_id}'].editor.setValue("print('Goodbye')")"""
8079
)
8180
click_run(selenium_utils_get, t1)
8281
output = t1.find_element_by_class_name("ac_output")
@@ -112,17 +111,14 @@ def test_activity_count(selenium_utils_progress):
112111
click_run(selenium_utils_progress, t2)
113112
pb = selenium_utils_progress.driver.find_element_by_id("subchapterprogress")
114113
assert pb
115-
total = selenium_utils_progress.driver.find_element_by_id(
116-
"scprogresstotal").text.strip()
114+
total = selenium_utils_progress.driver.find_element_by_id("scprogresstotal").text.strip()
117115
assert 2 == int(total)
118-
possible = selenium_utils_progress.driver.find_element_by_id(
119-
"scprogressposs").text.strip()
116+
possible = selenium_utils_progress.driver.find_element_by_id("scprogressposs").text.strip()
120117
# expect only 1 because the page isn't included when not using services
121118
assert 2 == int(possible)
122119
# count should not increment after a second click
123120
click_run(selenium_utils_progress, t2)
124-
total = selenium_utils_progress.driver.find_element_by_id(
125-
"scprogresstotal").text.strip()
121+
total = selenium_utils_progress.driver.find_element_by_id("scprogresstotal").text.strip()
126122
assert 2 == int(total)
127123

128124

@@ -132,8 +128,7 @@ def test_sql_activecode(selenium_utils_get):
132128
# TODO: We don't yet have a way for async operations in ActiveCode constructors to signal when they're complete. So, insert a delay to guesstimate when the async load of the SQL WASM code and other async functions complete.
133129
time.sleep(2)
134130
click_run(selenium_utils_get, t2)
135-
selenium_utils_get.wait.until(
136-
EC.text_to_be_present_in_element((By.ID, f"{div_id}_stdout"), "You"))
131+
selenium_utils_get.wait.until(EC.text_to_be_present_in_element((By.ID, f"{div_id}_stdout"), "You"))
137132
res = selenium_utils_get.driver.find_element_by_id(f"{div_id}_sql_out")
138133
assert res
139134
out = selenium_utils_get.driver.find_element_by_id(f"{div_id}_stdout")
@@ -151,7 +146,7 @@ def test_sql_activecode(selenium_utils_get):
151146
ta = t1.find_element_by_class_name("cm-s-default")
152147
assert ta
153148
selenium_utils_get.driver.execute_script(
154-
f"""window.componentMap['{div_id}'].editor.setValue("CREATE TABLE created_table (x TEXT); INSERT INTO created_table VALUES ('itworks');")"""
149+
f"""window.edList['{div_id}'].editor.setValue("CREATE TABLE created_table (x TEXT); INSERT INTO created_table VALUES ('itworks');")"""
155150
)
156151
click_run(selenium_utils_get, t1)
157152

@@ -160,14 +155,12 @@ def test_sql_activecode(selenium_utils_get):
160155
# TODO: We don't yet have a way for async operations in ActiveCode constructors to signal when they're complete. So, insert a delay to guesstimate when the async load of the SQL WASM code and other async functions complete.
161156
time.sleep(2)
162157
click_run(selenium_utils_get, t2)
163-
selenium_utils_get.wait.until(
164-
EC.text_to_be_present_in_element((By.ID, f"{div_id}_stdout"), "You"))
158+
selenium_utils_get.wait.until(EC.text_to_be_present_in_element((By.ID, f"{div_id}_stdout"), "You"))
165159
res = selenium_utils_get.driver.find_element_by_id(f"{div_id}_sql_out")
166160
assert res
167161
out = selenium_utils_get.driver.find_element_by_id(f"{div_id}_stdout")
168162
assert "You passed 1 out of 1 tests" in out.text
169163

170-
171164
@pytest.fixture
172165
def selenium_utils_sf(selenium_utils):
173166
selenium_utils.get("skulptfeatures.html")

runestone/timed/test/test_timed.py

Lines changed: 8 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -95,8 +95,7 @@ def _test_1(selenium_utils_mq, timed_divid):
9595
src, dest = dnd.find_elements_by_class_name("rsdraggable")
9696
src_items = src.find_elements_by_tag_name("span")
9797
for i in range(3):
98-
selenium_utils_mq.driver.execute_script(
99-
f"""$("#{src_items[i].get_attribute('id')}").simulateDragDrop({{ dropTarget: 'span:contains("Answer {src_items[i].text[8:]}")' }})""")
98+
selenium_utils_mq.driver.execute_script(f"""$("#{src_items[i].get_attribute('id')}").simulateDragDrop({{ dropTarget: 'span:contains("Answer {src_items[i].text[8:]}")' }})""")
10099
selenium_utils_mq.scroll_to_top()
101100
next.click()
102101

@@ -111,33 +110,27 @@ def _test_1(selenium_utils_mq, timed_divid):
111110
div_id = "test_timed_activecode_1"
112111
selenium_utils_mq.wait_until_ready(div_id)
113112
selenium_utils_mq.driver.execute_script(
114-
f"""window.componentMap['{div_id}'].editor.setValue("def add(a, b): return a + b")"""
113+
f"""window.edList['{div_id}'].editor.setValue("def add(a, b): return a + b")"""
115114
)
116115
next.click()
117116

118117
# The Parson's problem.
119118
selenium_utils_mq.wait_until_ready("test_timed_parsons_1")
120119
# This is an ugly hack, since Parson's problems number problems sequentially instead of based on the problem's ID. The div_id happens to match the ordering of Parson's problems...
121120
parsons_counter = timed_divid[-1]
122-
source = selenium_utils_mq.driver.find_element_by_id(
123-
f"parsons-{parsons_counter}-source")
124-
answer = selenium_utils_mq.driver.find_element_by_id(
125-
f"parsons-{parsons_counter}-answer")
126-
dragndrop(selenium_utils_mq, source.find_element_by_id(
127-
f"parsons-{parsons_counter}-block-0"), answer)
121+
source = selenium_utils_mq.driver.find_element_by_id(f"parsons-{parsons_counter}-source")
122+
answer = selenium_utils_mq.driver.find_element_by_id(f"parsons-{parsons_counter}-answer")
123+
dragndrop(selenium_utils_mq, source.find_element_by_id(f"parsons-{parsons_counter}-block-0"), answer)
128124
time.sleep(1)
129-
dragndrop(selenium_utils_mq, source.find_element_by_id(
130-
f"parsons-{parsons_counter}-block-2"), answer)
125+
dragndrop(selenium_utils_mq, source.find_element_by_id(f"parsons-{parsons_counter}-block-2"), answer)
131126
time.sleep(1)
132-
dragndrop(selenium_utils_mq, source.find_element_by_id(
133-
f"parsons-{parsons_counter}-block-1"), answer)
127+
dragndrop(selenium_utils_mq, source.find_element_by_id(f"parsons-{parsons_counter}-block-1"), answer)
134128
next.click()
135129

136130
# The short answer question.
137131
div_id = "test_timed_shortanswer_1"
138132
selenium_utils_mq.wait_until_ready(div_id)
139-
selenium_utils_mq.driver.find_element_by_id(
140-
f"{div_id}_solution").send_keys("ROYGBIV circle area")
133+
selenium_utils_mq.driver.find_element_by_id(f"{div_id}_solution").send_keys("ROYGBIV circle area")
141134

142135
finish(selenium_utils_mq)
143136
div_id = f"{timed_divid}results"

0 commit comments

Comments
 (0)