Completed
Pull Request — master (#70)
by
unknown
01:16
created

tests.hamcrest_unit_test.integration.MatchEqualityWrapperTest   A

Complexity

Total Complexity 10

Size/Duplication

Total Lines 20
Duplicated Lines 0 %
Metric Value
dl 0
loc 20
rs 10
wmc 10

5 Methods

Rating   Name   Duplication   Size   Complexity  
A MatchEqualityWrapperTest.testMatcherIsEqualWhenMatchesIsTrue() 0 3 2
A MatchEqualityWrapperTest.testMatcherIsNotEqualWhenMatchesIsFalse() 0 3 2
A MatchEqualityWrapperTest.testMatcherStringIsMatcherDescription() 0 3 2
A MatchEqualityWrapperTest.testMatchesWhenProvidedAnObject() 0 2 2
A MatchEqualityWrapperTest.testMatcherReprIsMatcher() 0 3 2
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