~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_rules.py

  • Committer: INADA Naoki
  • Date: 2011-05-05 09:15:34 UTC
  • mto: (5830.3.3 i18n-msgfmt)
  • mto: This revision was merged to the branch mainline in revision 5873.
  • Revision ID: songofacandy@gmail.com-20110505091534-7sv835xpofwrmpt4
Add update-pot command to Makefile and tools/bzrgettext script that
extracts help text from bzr commands.

Show diffs side-by-side

added added

removed removed

Lines of Context:
43
43
        rs = self.make_searcher(None)
44
44
        self.assertEquals((), rs.get_items('a.txt'))
45
45
        self.assertEquals((), rs.get_selected_items('a.txt', ['foo']))
46
 
        self.assertEquals(None, rs.get_single_value('a.txt', 'foo'))
47
46
 
48
47
    def test_get_items_file_empty(self):
49
48
        rs = self.make_searcher("")
50
49
        self.assertEquals((), rs.get_items('a.txt'))
51
50
        self.assertEquals((), rs.get_selected_items('a.txt', ['foo']))
52
 
        self.assertEquals(None, rs.get_single_value('a.txt', 'foo'))
53
51
 
54
52
    def test_get_items_from_extension_match(self):
55
53
        rs = self.make_searcher("[name *.txt]\nfoo=bar\na=True\n")
60
58
            rs.get_items('dir/a.txt'))
61
59
        self.assertEquals((('foo', 'bar'),),
62
60
            rs.get_selected_items('a.txt', ['foo']))
63
 
        self.assertEquals('bar', rs.get_single_value('a.txt', 'foo'))
64
61
 
65
62
    def test_get_items_from_multiple_glob_match(self):
66
63
        rs = self.make_searcher(
74
71
            rs.get_items('x x'))
75
72
        self.assertEquals((('foo', 'bar'), ('a', 'True')),
76
73
            rs.get_items('y y'))
77
 
        self.assertEquals('bar', rs.get_single_value('a.txt', 'foo'))
78
74
 
79
75
    def test_get_items_pathname_match(self):
80
76
        rs = self.make_searcher("[name ./a.txt]\nfoo=baz\n")
81
77
        self.assertEquals((('foo', 'baz'),),
82
78
            rs.get_items('a.txt'))
83
 
        self.assertEquals('baz', rs.get_single_value('a.txt', 'foo'))
84
79
        self.assertEquals((), rs.get_items('dir/a.txt'))
85
 
        self.assertEquals(None, rs.get_single_value('dir/a.txt', 'foo'))
86
80
 
87
81
    def test_get_items_match_first(self):
88
82
        rs = self.make_searcher(
90
84
            "[name *.txt]\nfoo=bar\na=True\n")
91
85
        self.assertEquals((('foo', 'baz'),),
92
86
            rs.get_items('a.txt'))
93
 
        self.assertEquals('baz', rs.get_single_value('a.txt', 'foo'))
94
87
        self.assertEquals((('foo', 'bar'), ('a', 'True')),
95
88
            rs.get_items('dir/a.txt'))
96
 
        self.assertEquals('bar', rs.get_single_value('dir/a.txt', 'foo'))
97
89
 
98
90
 
99
91
class TestStackedRulesSearcher(tests.TestCase):
115
107
            "[name *.txt]\nfoo=bar\na=True\n")
116
108
        self.assertEquals((('foo', 'baz'),),
117
109
            rs.get_items('a.txt'))
118
 
        self.assertEquals('baz', rs.get_single_value('a.txt', 'foo'))
119
 
        self.assertEquals(None, rs.get_single_value('a.txt', 'a'))
120
110
        self.assertEquals((('foo', 'bar'), ('a', 'True')),
121
111
            rs.get_items('dir/a.txt'))
122
 
        self.assertEquals('bar', rs.get_single_value('dir/a.txt', 'foo'))
123
 
        self.assertEquals('True', rs.get_single_value('dir/a.txt', 'a'))
124
112
 
125
113
 
126
114
class TestRulesPath(tests.TestCase):