Example #1
0
 def testSuccessfulMatchDoesNotGenerateMismatchDescription(self):
     self.assert_no_mismatch_description(described_as("irrelevant", anything()), object())
Example #2
0
    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)
Example #3
0
    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")
Example #5
0
    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")
Example #9
0
 def testSuccessfulMatchDoesNotGenerateMismatchDescription(self):
     self.assert_no_mismatch_description(
                             described_as('irrelevant', anything()),
                             object())
Example #10
0
    def testDelegatesMatchingToNestedMatcher(self):
        m1 = described_as('irrelevant', anything())
        m2 = described_as('irrelevant', NeverMatch())

        self.assertTrue(m1.matches(object()))
        self.assertTrue(not m2.matches('hi'))
Example #11
0
    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)
Example #12
0
    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)