MCPcopy
hub / github.com/django/django / _assertOptionsValues

Method _assertOptionsValues

django/contrib/admin/tests.py:211–229  ·  view source on GitHub ↗
(self, options_selector, values)

Source from the content-addressed store, hash-verified

209 )
210
211 def _assertOptionsValues(self, options_selector, values):
212 from selenium.webdriver.common.by import By
213
214 if values:
215 options = self.selenium.find_elements(By.CSS_SELECTOR, options_selector)
216 actual_values = []
217 for option in options:
218 actual_values.append(option.get_attribute("value"))
219 self.assertEqual(values, actual_values)
220 else:
221 # Prevent the `find_elements(By.CSS_SELECTOR, …)` call from
222 # blocking if the selector doesn't match any options as we expect
223 # it to be the case.
224 with self.disable_implicit_wait():
225 self.wait_until(
226 lambda driver: not driver.find_elements(
227 By.CSS_SELECTOR, options_selector
228 )
229 )
230
231 def assertSelectOptions(self, selector, values):
232 """

Callers 2

assertSelectOptionsMethod · 0.95
assertSelectedOptionsMethod · 0.95

Calls 3

wait_untilMethod · 0.95
disable_implicit_waitMethod · 0.80
appendMethod · 0.45

Tested by

no test coverage detected