Esempio n. 1
0
 def testSuccessfulMatchDoesNotGenerateMismatchDescription(self):
     self.assert_no_mismatch_description(described_as("irrelevant", anything()), object())
Esempio n. 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)
Esempio n. 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"))
Esempio n. 4
0
 def testMatchAlwaysSucceedsSoShouldNotGenerateMismatchDescription(self):
     self.assert_no_mismatch_description(anything(), "hi")
Esempio n. 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)
Esempio n. 6
0
 def testHasUsefulDefaultDescription(self):
     self.assert_description("ANYTHING", anything())
Esempio n. 7
0
 def testCanOverrideDescription(self):
     description = "DESCRIPTION"
     self.assert_description(description, anything(description))
Esempio n. 8
0
 def testAlwaysEvaluatesToTrue(self):
     self.assert_matches("None", anything(), None)
     self.assert_matches("object", anything(), object())
     self.assert_matches("string", anything(), "hi")
Esempio n. 9
0
 def testSuccessfulMatchDoesNotGenerateMismatchDescription(self):
     self.assert_no_mismatch_description(
                             described_as('irrelevant', anything()),
                             object())
Esempio n. 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'))
Esempio n. 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)
Esempio n. 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)