~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/per_workingtree/test_views.py

  • Committer: Patch Queue Manager
  • Date: 2016-02-01 19:13:13 UTC
  • mfrom: (6614.2.2 trunk)
  • Revision ID: pqm@pqm.ubuntu.com-20160201191313-wdfvmfff1djde6oq
(vila) Release 2.7.0 (Vincent Ladeuil)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2008 Canonical Ltd
 
1
# Copyright (C) 2008, 2009, 2012, 2016 Canonical Ltd
2
2
#
3
3
# This program is free software; you can redistribute it and/or modify
4
4
# it under the terms of the GNU General Public License as published by
56
56
            'other-name': ['dir-2']}
57
57
        wt.views.set_view_info(view_current, view_dict)
58
58
        current, views = wt.views.get_view_info()
59
 
        self.assertEquals(view_current, current)
60
 
        self.assertEquals(view_dict, views)
 
59
        self.assertEqual(view_current, current)
 
60
        self.assertEqual(view_dict, views)
61
61
        # then reopen the tree and see they're still there
62
62
        wt = WorkingTree.open('wt')
63
63
        current, views = wt.views.get_view_info()
64
 
        self.assertEquals(view_current, current)
65
 
        self.assertEquals(view_dict, views)
 
64
        self.assertEqual(view_current, current)
 
65
        self.assertEqual(view_dict, views)
66
66
        # test setting a current view which does not exist
67
67
        self.assertRaises(errors.NoSuchView,
68
68
            wt.views.set_view_info, 'yet-another', view_dict)
69
69
        current, views = wt.views.get_view_info()
70
 
        self.assertEquals(view_current, current)
71
 
        self.assertEquals(view_dict, views)
 
70
        self.assertEqual(view_current, current)
 
71
        self.assertEqual(view_dict, views)
72
72
        # test clearing the current view
73
73
        wt.views.set_view_info(None, view_dict)
74
74
        current, views = wt.views.get_view_info()
75
 
        self.assertEquals(None, current)
76
 
        self.assertEquals(view_dict, views)
 
75
        self.assertEqual(None, current)
 
76
        self.assertEqual(view_dict, views)
77
77
 
78
78
    def test_lookup_view(self):
79
79
        wt = self.make_branch_and_tree('wt')
94
94
        # test that set_view sets the current view by default
95
95
        wt.views.set_view('view-1', ['dir-1'])
96
96
        current, views = wt.views.get_view_info()
97
 
        self.assertEquals('view-1', current)
98
 
        self.assertEquals({'view-1': ['dir-1']}, views)
 
97
        self.assertEqual('view-1', current)
 
98
        self.assertEqual({'view-1': ['dir-1']}, views)
99
99
        # test adding a view and not making it the current one
100
100
        wt.views.set_view('view-2', ['dir-2'], make_current=False)
101
101
        current, views = wt.views.get_view_info()
102
 
        self.assertEquals('view-1', current)
103
 
        self.assertEquals({'view-1': ['dir-1'], 'view-2': ['dir-2']}, views)
 
102
        self.assertEqual('view-1', current)
 
103
        self.assertEqual({'view-1': ['dir-1'], 'view-2': ['dir-2']}, views)
104
104
 
105
105
    def test_unicode_view(self):
106
106
        wt = self.make_branch_and_tree('wt')
109
109
        view_dict = {view_name: view_files}
110
110
        wt.views.set_view_info(view_name, view_dict)
111
111
        current, views = wt.views.get_view_info()
112
 
        self.assertEquals(view_name, current)
113
 
        self.assertEquals(view_dict, views)
 
112
        self.assertEqual(view_name, current)
 
113
        self.assertEqual(view_dict, views)
114
114
 
115
115
    def test_no_such_view(self):
116
116
        wt = self.make_branch_and_tree('wt')
117
117
        try:
118
118
            wt.views.lookup_view('opaque')
119
119
        except errors.NoSuchView, e:
120
 
            self.assertEquals(e.view_name, 'opaque')
121
 
            self.assertEquals(str(e), 'No such view: opaque.')
 
120
            self.assertEqual(e.view_name, 'opaque')
 
121
            self.assertEqual(str(e), 'No such view: opaque.')
122
122
        else:
123
123
            self.fail("didn't get expected exception")
124
124
 
133
133
        self.assertRaises(errors.NoSuchView,
134
134
            wt.views.lookup_view, view_name)
135
135
        # and it's not in the dictionary
136
 
        self.assertEquals(wt.views.get_view_info()[1], {})
 
136
        self.assertEqual(wt.views.get_view_info()[1], {})
137
137
        # and you can't remove it a second time
138
138
        self.assertRaises(errors.NoSuchView,
139
139
            wt.views.delete_view, view_name)