~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_matchers.py

  • Committer: Jelmer Vernooij
  • Date: 2011-05-16 13:39:39 UTC
  • mto: (5923.1.1 trunk)
  • mto: This revision was merged to the branch mainline in revision 5925.
  • Revision ID: jelmer@samba.org-20110516133939-8u1pc9utas3uw1lt
Require a unicode prompt to be passed into all methods that prompt.

Show diffs side-by-side

added added

removed removed

Lines of Context:
18
18
 
19
19
from testtools.matchers import *
20
20
 
21
 
from bzrlib.tests import (
22
 
    TestCase,
23
 
    TestCaseWithTransport,
24
 
    )
 
21
from bzrlib.tests import TestCase
25
22
from bzrlib.tests.matchers import *
26
23
 
27
24
 
65
62
        self.assertNotEqual(None, mismatch)
66
63
        self.assertThat(mismatch.describe(), Equals("I am da tree is locked"))
67
64
 
68
 
 
69
 
class TestMatchesAncestry(TestCaseWithTransport):
70
 
 
71
 
    def test__str__(self):
72
 
        matcher = MatchesAncestry("A repository", "arevid")
73
 
        self.assertEqual(
74
 
            "MatchesAncestry(repository='A repository', "
75
 
            "revision_id='arevid')",
76
 
            str(matcher))
77
 
 
78
 
    def test_match(self):
79
 
        b = self.make_branch_builder('.')
80
 
        b.start_series()
81
 
        revid1 = b.build_commit()
82
 
        revid2 = b.build_commit()
83
 
        b.finish_series()
84
 
        branch = b.get_branch()
85
 
        m = MatchesAncestry(branch.repository, revid2)
86
 
        self.assertThat([revid2, revid1], m)
87
 
        self.assertThat([revid1, revid2], m)
88
 
        m = MatchesAncestry(branch.repository, revid1)
89
 
        self.assertThat([revid1], m)
90
 
        m = MatchesAncestry(branch.repository, "unknown")
91
 
        self.assertThat(["unknown"], m)
92
 
 
93
 
    def test_mismatch(self):
94
 
        b = self.make_branch_builder('.')
95
 
        b.start_series()
96
 
        revid1 = b.build_commit()
97
 
        revid2 = b.build_commit()
98
 
        b.finish_series()
99
 
        branch = b.get_branch()
100
 
        m = MatchesAncestry(branch.repository, revid1)
101
 
        mismatch = m.match([])
102
 
        self.assertIsNot(None, mismatch)
103
 
        self.assertEquals(
104
 
            "mismatched ancestry for revision '%s' was ['%s'], expected []" % (
105
 
                revid1, revid1),
106
 
            mismatch.describe())