本文整理汇总了Python中testtools.matchers.MatchesStructure.fromExample方法的典型用法代码示例。如果您正苦于以下问题:Python MatchesStructure.fromExample方法的具体用法?Python MatchesStructure.fromExample怎么用?Python MatchesStructure.fromExample使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类testtools.matchers.MatchesStructure
的用法示例。
在下文中一共展示了MatchesStructure.fromExample方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_if_message_given_message
# 需要导入模块: from testtools.matchers import MatchesStructure [as 别名]
# 或者: from testtools.matchers.MatchesStructure import fromExample [as 别名]
def test_if_message_given_message(self):
# Annotate.if_message returns an annotated version of the matcher if a
# message is provided.
matcher = Equals(1)
expected = Annotate("foo", matcher)
annotated = Annotate.if_message("foo", matcher)
self.assertThat(annotated, MatchesStructure.fromExample(expected, "annotation", "matcher"))
示例2: test_DDEBsGetOverrideFromDEBs
# 需要导入模块: from testtools.matchers import MatchesStructure [as 别名]
# 或者: from testtools.matchers.MatchesStructure import fromExample [as 别名]
def test_DDEBsGetOverrideFromDEBs(self):
# Test the basic case ensuring that DDEB files always match the
# DEB's overrides.
deb = self.addFile("foo_1.0_i386.deb", "main/devel", "extra")
ddeb = self.addFile("foo-dbgsym_1.0_i386.ddeb", "universe/web", "low")
self.assertMatchDDEBErrors([])
self.upload._overrideDDEBSs()
self.assertThat(ddeb, MatchesStructure.fromExample(deb, "component_name", "section_name", "priority_name"))
示例3: test_getConfigs_maps_distro_and_purpose_to_matching_config
# 需要导入模块: from testtools.matchers import MatchesStructure [as 别名]
# 或者: from testtools.matchers.MatchesStructure import fromExample [as 别名]
def test_getConfigs_maps_distro_and_purpose_to_matching_config(self):
distro = self.makeDistroWithPublishDirectory()
script = self.makeScript(distro)
script.setUp()
reference_config = getPubConfig(distro.main_archive)
config = script.getConfigs()[distro][ArchivePurpose.PRIMARY]
self.assertThat(
config, MatchesStructure.fromExample(
reference_config, 'temproot', 'distroroot', 'archiveroot'))
示例4: test_fromExample
# 需要导入模块: from testtools.matchers import MatchesStructure [as 别名]
# 或者: from testtools.matchers.MatchesStructure import fromExample [as 别名]
def test_fromExample(self):
self.assertThat(
self.SimpleClass(1, 2),
MatchesStructure.fromExample(self.SimpleClass(1, 3), 'x'))