def testSuccessfulMatchDoesNotGenerateMismatchDescription(self): self.assert_no_mismatch_description(described_as("irrelevant", anything()), object())
def testAppendsValuesToDescription(self): m = described_as("value 1 = %0, value 2 = %1", anything(), 33, 97) self.assert_description("value 1 = <33>, value 2 = <97>", m)
def testDelegatesMatchingToNestedMatcher(self): m1 = described_as("irrelevant", anything()) m2 = described_as("irrelevant", NeverMatch()) self.assertTrue(m1.matches(object())) self.assertTrue(not m2.matches("hi"))
def testMatchAlwaysSucceedsSoShouldNotGenerateMismatchDescription(self): self.assert_no_mismatch_description(anything(), "hi")
def testOverridesDescriptionOfNestedMatcherWithConstructorArgument(self): m1 = described_as("m1 description", anything()) m2 = described_as("m2 description", NeverMatch()) self.assert_description("m1 description", m1) self.assert_description("m2 description", m2)
def testHasUsefulDefaultDescription(self): self.assert_description("ANYTHING", anything())
def testCanOverrideDescription(self): description = "DESCRIPTION" self.assert_description(description, anything(description))
def testAlwaysEvaluatesToTrue(self): self.assert_matches("None", anything(), None) self.assert_matches("object", anything(), object()) self.assert_matches("string", anything(), "hi")
def testSuccessfulMatchDoesNotGenerateMismatchDescription(self): self.assert_no_mismatch_description( described_as('irrelevant', anything()), object())
def testDelegatesMatchingToNestedMatcher(self): m1 = described_as('irrelevant', anything()) m2 = described_as('irrelevant', NeverMatch()) self.assertTrue(m1.matches(object())) self.assertTrue(not m2.matches('hi'))
def testAppendsValuesToDescription(self): m = described_as('value 1 = %0, value 2 = %1', anything(), 33, 97) self.assert_description('value 1 = <33>, value 2 = <97>', m)
def testOverridesDescriptionOfNestedMatcherWithConstructorArgument(self): m1 = described_as('m1 description', anything()) m2 = described_as('m2 description', NeverMatch()) self.assert_description('m1 description', m1) self.assert_description('m2 description', m2)