本文整理汇总了Python中asserts.assert_equal函数的典型用法代码示例。如果您正苦于以下问题:Python assert_equal函数的具体用法?Python assert_equal怎么用?Python assert_equal使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了assert_equal函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_remove_attribute
def test_remove_attribute(self):
element = Element("div")
element.remove_attribute("foo")
element.set_attribute("foo", "bar")
element.remove_attribute("foo")
assert_is_none(element.get_attribute("foo"))
assert_equal([b'<div>', b"</div>"], list(iter(element)))
示例2: test_attributes
def test_attributes(self):
number = NumberInput()
number.minimum = 4.1
number.maximum = 10.5
number.step = 0.8
assert_equal('<input max="10.5" min="4.1" step="0.8" type="number"/>',
str(number))
示例3: test_create_option__option_object
def test_create_option__option_object(self):
select = Select()
option = select.create_option("Option Label", "test-value",
selected=True)
assert_equal("option", option.element_name)
assert_equal("test-value", option.value)
assert_true(option.selected)
示例4: test_scripts
def test_scripts(self):
head = _TestingHead()
doc = Document()
doc.root.head = head
doc.add_script("script.js")
doc.add_scripts("script1.js", "script2.js")
assert_equal(["script.js", "script1.js", "script2.js"], head.scripts)
示例5: test_time_with_fraction
def test_time_with_fraction(self):
class MyElement(Element):
attr = time_html_attribute("data-time")
element = MyElement("div")
element.attr = datetime.time(14, 13, 9, 123456)
assert_equal(datetime.time(14, 13, 9, 123456), element.attr)
assert_equal('<div data-time="14:13:09.123456"></div>', str(element))
示例6: test_default_language
def test_default_language(self):
root = HTMLRoot()
root.head = _TestingHead()
assert_equal([b'<html lang="en" xml:lang="en" '
b'xmlns="http://www.w3.org/1999/xhtml">',
b'<body>', b'</body>', b'</html>'],
list(iter(root)))
示例7: test_append
def test_append(self):
doc = Document()
old_child_count = len(doc.root.head)
doc.append_head("Test Head")
assert_equal(old_child_count + 1, len(doc.root.head))
doc.append_body("Test Body")
assert_equal(1, len(doc.root.body))
示例8: test_generate_with_children
def test_generate_with_children(self):
element = Element("div")
element.extend(["<foo>", "&"])
element.append_raw("<bar>")
assert_equal(
[b"<div>", b"<foo>", b"&", b"<bar>", b"</div>"],
list(iter(element)))
示例9: test_create_column
def test_create_column(self):
group = ColumnGroup()
col = group.create_column()
col.add_css_classes("col-cls")
group.create_column()
assert_equal('<colgroup><col class=\"col-cls\"></col><col></col>'
'</colgroup>', str(group))
示例10: test_add_multiple_css_classes
def test_add_multiple_css_classes(self):
element = Element("div")
element.add_css_classes("foo", "bar", "baz")
element.add_css_classes("bar")
matches = re.search(r'class="(.*)"', str(element))
css_classes = matches.group(1).split(" ")
css_classes.sort()
assert_equal(["bar", "baz", "foo"], css_classes)
示例11: test_append
def test_append(self):
head = _TestingHead()
doc = Document()
doc.root.head = head
doc.append_head("Test Head")
assert_equal(1, len(head))
doc.append_body("Test Body")
assert_equal(1, len(doc.root.body))
示例12: test_defaults
def test_defaults(self):
time = TimeInput()
assert_equal("", time.name)
assert_is_none(time.time)
assert_is_none(time.minimum)
assert_is_none(time.maximum)
assert_is_none(time.step)
assert_equal('<input type="time"/>', str(time))
示例13: test_stylesheets
def test_stylesheets(self):
head = _TestingHead()
doc = Document()
doc.root.head = head
doc.add_stylesheet("style.css")
doc.add_stylesheets("style1.css", "style2.css")
assert_equal(["style.css", "style1.css", "style2.css"],
head.stylesheets)
示例14: test_append_extend
def test_append_extend(self):
element = Element("div")
element.append("Hello")
element.extend([", ", "World", "!"])
assert_equal(4, len(element))
element.append_raw("Hello")
element.extend_raw([", ", "World", "!"])
assert_equal(8, len(element))
示例15: test_generate_children
def test_generate_children(self):
class TestingElement(NonVoidElement):
def generate_children(self):
yield "Hello World!"
yield VoidElement("br")
element = TestingElement("div")
assert_equal([b"<div>", b"Hello World!", b"<br/>", b"</div>"],
list(iter(element)))