testMatcherIsEqualWhenMatchesIsTrue()   A
last analyzed

Complexity

Conditions 2

Size

Total Lines 3

Duplication

Lines 0
Ratio 0 %
Metric Value
cc 2
dl 0
loc 3
rs 10
1
if __name__ == "__main__":
2
    import sys
3
    sys.path.insert(0, '..')
4
    sys.path.insert(0, '../..')
5
6
from hamcrest.library.integration.match_equality import *
7
8
from hamcrest.core.core.isequal import equal_to
9
from hamcrest.core.string_description import tostring
10
import unittest
11
12
__author__ = "Chris Rose"
13
__copyright__ = "Copyright 2011 hamcrest.org"
14
__license__ = "BSD, see License.txt"
15
16
17
class MatchEqualityWrapperTest(unittest.TestCase):
18
19
    def testMatcherIsEqualWhenMatchesIsTrue(self):
20
        matcher = equal_to('bar')
21
        assert match_equality(matcher) == 'bar'
22
23
    def testMatcherIsNotEqualWhenMatchesIsFalse(self):
24
        matcher = equal_to('bar')
25
        assert match_equality(matcher) != 'foo'
26
27
    def testMatcherStringIsMatcherDescription(self):
28
        matcher = equal_to('bar')
29
        assert str(match_equality(matcher)) == tostring(matcher)
30
31
    def testMatcherReprIsMatcher(self):
32
        matcher = equal_to('bar')
33
        assert repr(match_equality(matcher)) == tostring(matcher)
34
35
    def testMatchesWhenProvidedAnObject(self):
36
        assert match_equality('bar') == 'bar'
37
38
39
if __name__ == "__main__":
40
    unittest.main()
41