File: match_equality_test.py

package info (click to toggle)
pyhamcrest 1.6-1
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 556 kB
  • sloc: python: 2,938; makefile: 2
file content (40 lines) | stat: -rw-r--r-- 1,153 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
if __name__ == "__main__":
    import sys
    sys.path.insert(0, '..')
    sys.path.insert(0, '../..')

from hamcrest.library.integration.match_equality import *

from hamcrest.core.core.isequal import equal_to
from hamcrest.core.string_description import tostring
import unittest

__author__ = "Chris Rose"
__copyright__ = "Copyright 2011 hamcrest.org"
__license__ = "BSD, see License.txt"


class MatchEqualityWrapperTest(unittest.TestCase):

    def testMatcherIsEqualWhenMatchesIsTrue(self):
        matcher = equal_to('bar')
        assert match_equality(matcher) == 'bar'

    def testMatcherIsNotEqualWhenMatchesIsFalse(self):
        matcher = equal_to('bar')
        assert match_equality(matcher) != 'foo'

    def testMatcherStringIsMatcherDescription(self):
        matcher = equal_to('bar')
        assert str(match_equality(matcher)) == tostring(matcher)

    def testMatcherReprIsMatcher(self):
        matcher = equal_to('bar')
        assert repr(match_equality(matcher)) == tostring(matcher)

    def testMatchesWhenProvidedAnObject(self):
        assert match_equality('bar') == 'bar'


if __name__ == "__main__":
    unittest.main()