本文整理汇总了Python中asserts.assert_equal函数的典型用法代码示例。如果您正苦于以下问题:Python assert_equal函数的具体用法?Python assert_equal怎么用?Python assert_equal使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了assert_equal函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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)))
开发者ID:unkvuzutop,项目名称:python-htmlgen,代码行数:7,代码来源:element.py
示例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))
开发者ID:srittau,项目名称:python-htmlgen,代码行数:7,代码来源:form.py
示例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)
开发者ID:srittau,项目名称:python-htmlgen,代码行数:7,代码来源:form.py
示例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)
开发者ID:srittau,项目名称:python-htmlgen,代码行数:7,代码来源:document.py
示例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))
开发者ID:srittau,项目名称:python-htmlgen,代码行数:7,代码来源:attribute.py
示例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)))
开发者ID:unkvuzutop,项目名称:python-htmlgen,代码行数:7,代码来源:document.py
示例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))
开发者ID:srittau,项目名称:python-htmlgen,代码行数:7,代码来源:document.py
示例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)))
开发者ID:unkvuzutop,项目名称:python-htmlgen,代码行数:7,代码来源:element.py
示例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))
开发者ID:unkvuzutop,项目名称:python-htmlgen,代码行数:7,代码来源:table.py
示例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)
开发者ID:unkvuzutop,项目名称:python-htmlgen,代码行数:8,代码来源:element.py
示例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))
开发者ID:unkvuzutop,项目名称:python-htmlgen,代码行数:8,代码来源:document.py
示例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))
开发者ID:srittau,项目名称:python-htmlgen,代码行数:8,代码来源:form.py
示例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)
开发者ID:srittau,项目名称:python-htmlgen,代码行数:8,代码来源:document.py
示例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))
开发者ID:unkvuzutop,项目名称:python-htmlgen,代码行数:8,代码来源:element.py
示例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)))
开发者ID:unkvuzutop,项目名称:python-htmlgen,代码行数:8,代码来源:element.py
示例16: test_boolean_attributes
def test_boolean_attributes(self):
input_ = Input()
input_.disabled = True
input_.focus = True
input_.readonly = True
assert_equal([b'<input autofocus="autofocus" disabled="disabled" '
b'readonly="readonly" type="text"/>'],
list(iter(input_)))
开发者ID:srittau,项目名称:python-htmlgen,代码行数:8,代码来源:form.py
示例17: test_create_option__selected
def test_create_option__selected(self):
select = Select()
option = select.create_option("Option Label", "test-value",
selected=True)
assert_is(option, select.selected_option)
assert_equal(
'<select><option selected="selected" value="test-value">'
'Option Label</option></select>',
str(select))
开发者ID:srittau,项目名称:python-htmlgen,代码行数:9,代码来源:form.py
示例18: test_remove_css_classes
def test_remove_css_classes(self):
element = Element("div")
element.add_css_classes("foo", "bar", "baz")
element.remove_css_classes("bar", "xxx")
matches = re.search(r'class="(.*)"', str(element))
assert matches is not None
css_classes = matches.group(1).split(" ")
css_classes.sort()
assert_equal(["baz", "foo"], css_classes)
开发者ID:srittau,项目名称:python-htmlgen,代码行数:9,代码来源:element.py
示例19: test_set_selected_value
def test_set_selected_value(self):
select = Select()
select.create_option("L1", "v1")
option = select.create_option("L2", "v2")
select.create_option("L3", "v3")
select.selected_value = "v2"
assert_equal("v2", select.selected_value)
assert_is(option, select.selected_option)
assert_true(option.selected)
开发者ID:srittau,项目名称:python-htmlgen,代码行数:9,代码来源:form.py
示例20: test_minimum_maximum
def test_minimum_maximum(self):
time = TimeInput()
time.minimum = datetime.time(12, 14)
time.maximum = datetime.time(19, 45)
assert_equal('<input max="19:45:00" min="12:14:00" type="time"/>',
str(time))
time.minimum = None
time.maximum = None
assert_equal('<input type="time"/>', str(time))
开发者ID:srittau,项目名称:python-htmlgen,代码行数:9,代码来源:form.py
注:本文中的asserts.assert_equal函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论