本文整理汇总了Python中salad.tests.util.assert_with_negate函数的典型用法代码示例。如果您正苦于以下问题:Python assert_with_negate函数的具体用法?Python assert_with_negate怎么用?Python assert_with_negate使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了assert_with_negate函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: assert_element_exists_with_negate
def assert_element_exists_with_negate(negate, text, partial, function):
infix = "partial_" if partial else ""
found = True
try:
_get_visible_element(function % (infix, ), None, text)
except (ElementDoesNotExist, ElementIsNotVisible,
ElementAtIndexDoesNotExist):
found = False
assert_with_negate(found, negate)
return True
示例2: assert_alert_with_text
def assert_alert_with_text(negate, type_of_match, text):
world.prompt = _get_alert_or_none()
prompt_exists = world.prompt is not None
text_exists = None
if "contains" in type_of_match:
text_exists = text in world.prompt.text
else:
text_exists = world.prompt.text == text
assert_with_negate(prompt_exists and text_exists, negate)
if world.prompt:
world.prompt.accept()
return True
示例3: assert_alert_with_stored_value
def assert_alert_with_stored_value(negate, type_of_match, upper_lower, name):
world.prompt = _get_alert_or_none()
assert world.stored_values[name]
stored = world.stored_values[name]
current = world.prompt.text
if upper_lower:
stored, current = transform_for_upper_lower_comparison(stored, current, upper_lower)
prompt_exists = world.prompt is not None
text_exists = None
if "contains" in type_of_match:
text_exists = stored in current
else:
text_exists = stored == current
assert_with_negate(prompt_exists and text_exists, negate)
if world.prompt:
world.prompt.accept()
return True
示例4: _check_is_on_page
def _check_is_on_page(page, negate):
if page not in leaf_world.available_pages:
raise KeyError('"%s" page is undefined.' % page)
if page not in leaf_world.pages:
try:
page_object = create_page_object(page)
except KeyError:
raise
else:
page_object = leaf_world.pages[page]
is_on_page = page_object.is_current(world.browser.url, get_page_url(world.browser.url))
assert_with_negate(is_on_page, negate)
leaf_world.current_page = page_object
示例5: should_see_alert_with_text
def should_see_alert_with_text(step, negate, text):
alert = _get_alert_or_none()
assert_with_negate(alert is not None and alert.text == text, negate)
if alert:
alert.accept()
示例6: should_see_alert
def should_see_alert(step, negate):
alert = _get_alert_or_none()
assert_with_negate(alert is not None, negate)
if alert:
alert.accept()
示例7: assert_text_present_with_negates
def assert_text_present_with_negates(negate, text):
body = world.browser.driver.find_element_by_tag_name('body')
assert_with_negate(text in body.text, negate)
return True
示例8: assert_url_equals
def assert_url_equals(negate, partial, url):
if partial == 'is':
assert_equals_with_negate(world.browser.url, url, negate)
else:
assert_with_negate(url in world.browser.url, negate)
return True
示例9: _this_step
def _this_step(step, negate, first, last, find_pattern, attr_name):
ele = _get_element(finder_function, first, last, find_pattern)
assert_with_negate(ele[attr_name] != None, negate)
示例10: should_see_a_link_to
def should_see_a_link_to(step, negate, link):
assert_with_negate(len(world.browser.find_link_by_href(link)) > 0, negate)
示例11: should_see_in_the_page
def should_see_in_the_page(step, negate, text):
assert_with_negate(text in world.browser.html, negate)
示例12: should_see_in_the_page
def should_see_in_the_page(step, negate, text):
assert_with_negate(world.browser.is_text_present(text), negate)
示例13: assert_alert
def assert_alert(negate):
world.prompt = _get_alert_or_none()
assert_with_negate(world.prompt is not None, negate)
if world.prompt:
world.prompt.accept()
return True
示例14: should_see_prompt
def should_see_prompt(step, negate):
world.prompt = _get_alert_or_none()
assert_with_negate(world.prompt is not None, negate)
if world.prompt:
world.prompt.accept()
示例15: contains_test
def contains_test(element, negate, *args):
content = args[0]
text = getattr(element, 'text', None)
assert_with_negate(content in text, negate)