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"))
def match(self, observed): matcher = MatchesAll( IsInstance(partial), MatchesStructure.fromExample( self.expected, "func", "args", "keywords"), first_only=True, ) return matcher.match(observed)
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'))
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"))
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'))
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'))
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"))
def test_fromExample(self): self.assertThat( self.SimpleClass(1, 2), MatchesStructure.fromExample(self.SimpleClass(1, 3), 'x'))
def test_fromExample(self): self.assertThat( self.SimpleClass(1, 2), MatchesStructure.fromExample(self.SimpleClass(1, 3), 'x'))