~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/per_versionedfile.py

  • Committer: Patch Queue Manager
  • Date: 2016-04-21 04:10:52 UTC
  • mfrom: (6616.1.1 fix-en-user-guide)
  • Revision ID: pqm@pqm.ubuntu.com-20160421041052-clcye7ns1qcl2n7w
(richard-wilbur) Ensure build of English use guide always uses English text
 even when user's locale specifies a different language. (Jelmer Vernooij)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2006-2011 Canonical Ltd
 
1
# Copyright (C) 2006-2012, 2016 Canonical Ltd
2
2
#
3
3
# Authors:
4
4
#   Johan Rydberg <jrydberg@gnu.org>
182
182
            versions = f.versions()
183
183
            self.assertTrue('r0' in versions)
184
184
            self.assertTrue('r1' in versions)
185
 
            self.assertEquals(f.get_lines('r0'), ['a\n', 'b\n'])
186
 
            self.assertEquals(f.get_text('r0'), 'a\nb\n')
187
 
            self.assertEquals(f.get_lines('r1'), ['b\n', 'c\n'])
 
185
            self.assertEqual(f.get_lines('r0'), ['a\n', 'b\n'])
 
186
            self.assertEqual(f.get_text('r0'), 'a\nb\n')
 
187
            self.assertEqual(f.get_lines('r1'), ['b\n', 'c\n'])
188
188
            self.assertEqual(2, len(f))
189
189
            self.assertEqual(2, f.num_versions())
190
190
 
216
216
            self.assertTrue('r0' in versions)
217
217
            self.assertTrue('r1' in versions)
218
218
            self.assertTrue('r2' in versions)
219
 
            self.assertEquals(f.get_lines('r0'), ['a\n', 'b\n'])
220
 
            self.assertEquals(f.get_lines('r1'), ['b\n', 'c\n'])
221
 
            self.assertEquals(f.get_lines('r2'), ['c\n', 'd\n'])
 
219
            self.assertEqual(f.get_lines('r0'), ['a\n', 'b\n'])
 
220
            self.assertEqual(f.get_lines('r1'), ['b\n', 'c\n'])
 
221
            self.assertEqual(f.get_lines('r2'), ['c\n', 'd\n'])
222
222
            self.assertEqual(3, f.num_versions())
223
223
            origins = f.annotate('r1')
224
 
            self.assertEquals(origins[0][0], 'r0')
225
 
            self.assertEquals(origins[1][0], 'r1')
 
224
            self.assertEqual(origins[0][0], 'r0')
 
225
            self.assertEqual(origins[1][0], 'r1')
226
226
            origins = f.annotate('r2')
227
 
            self.assertEquals(origins[0][0], 'r1')
228
 
            self.assertEquals(origins[1][0], 'r2')
 
227
            self.assertEqual(origins[0][0], 'r1')
 
228
            self.assertEqual(origins[1][0], 'r2')
229
229
 
230
230
        verify_file(f)
231
231
        f = self.reopen_file()
595
595
        f.add_lines('r0', [], ['a\n', 'b\n'])
596
596
        f.add_lines('r1', ['r0'], ['c\n', 'b\n'])
597
597
        origins = f.annotate('r1')
598
 
        self.assertEquals(origins[0][0], 'r1')
599
 
        self.assertEquals(origins[1][0], 'r0')
 
598
        self.assertEqual(origins[0][0], 'r1')
 
599
        self.assertEqual(origins[1][0], 'r0')
600
600
 
601
601
        self.assertRaises(RevisionNotPresent,
602
602
            f.annotate, 'foo')
746
746
                                 ['base', 'a_ghost'],
747
747
                                 ['line\n', 'line_b\n', 'line_c\n'])
748
748
        origins = vf.annotate('references_ghost')
749
 
        self.assertEquals(('base', 'line\n'), origins[0])
750
 
        self.assertEquals(('base', 'line_b\n'), origins[1])
751
 
        self.assertEquals(('references_ghost', 'line_c\n'), origins[2])
 
749
        self.assertEqual(('base', 'line\n'), origins[0])
 
750
        self.assertEqual(('base', 'line_b\n'), origins[1])
 
751
        self.assertEqual(('references_ghost', 'line_c\n'), origins[2])
752
752
 
753
753
    def test_readonly_mode(self):
754
754
        t = self.get_transport()
2768
2768
                          [])
2769
2769
 
2770
2770
    def test_get_sha1s_nonexistent(self):
2771
 
        self.assertEquals({}, self.texts.get_sha1s([("NONEXISTENT",)]))
 
2771
        self.assertEqual({}, self.texts.get_sha1s([("NONEXISTENT",)]))
2772
2772
 
2773
2773
    def test_get_sha1s(self):
2774
2774
        self._lines["key"] = ["dataline1", "dataline2"]
2775
 
        self.assertEquals({("key",): osutils.sha_strings(self._lines["key"])},
 
2775
        self.assertEqual({("key",): osutils.sha_strings(self._lines["key"])},
2776
2776
                           self.texts.get_sha1s([("key",)]))
2777
2777
 
2778
2778
    def test_get_parent_map(self):
2779
2779
        self._parent_map = {"G": ("A", "B")}
2780
 
        self.assertEquals({("G",): (("A",),("B",))},
 
2780
        self.assertEqual({("G",): (("A",),("B",))},
2781
2781
                          self.texts.get_parent_map([("G",), ("L",)]))
2782
2782
 
2783
2783
    def test_get_record_stream(self):
2784
2784
        self._lines["A"] = ["FOO", "BAR"]
2785
2785
        it = self.texts.get_record_stream([("A",)], "unordered", True)
2786
2786
        record = it.next()
2787
 
        self.assertEquals("chunked", record.storage_kind)
2788
 
        self.assertEquals("FOOBAR", record.get_bytes_as("fulltext"))
2789
 
        self.assertEquals(["FOO", "BAR"], record.get_bytes_as("chunked"))
 
2787
        self.assertEqual("chunked", record.storage_kind)
 
2788
        self.assertEqual("FOOBAR", record.get_bytes_as("fulltext"))
 
2789
        self.assertEqual(["FOO", "BAR"], record.get_bytes_as("chunked"))
2790
2790
 
2791
2791
    def test_get_record_stream_absent(self):
2792
2792
        it = self.texts.get_record_stream([("A",)], "unordered", True)
2793
2793
        record = it.next()
2794
 
        self.assertEquals("absent", record.storage_kind)
 
2794
        self.assertEqual("absent", record.storage_kind)
2795
2795
 
2796
2796
    def test_iter_lines_added_or_present_in_keys(self):
2797
2797
        self._lines["A"] = ["FOO", "BAR"]
2798
2798
        self._lines["B"] = ["HEY"]
2799
2799
        self._lines["C"] = ["Alberta"]
2800
2800
        it = self.texts.iter_lines_added_or_present_in_keys([("A",), ("B",)])
2801
 
        self.assertEquals(sorted([("FOO", "A"), ("BAR", "A"), ("HEY", "B")]),
 
2801
        self.assertEqual(sorted([("FOO", "A"), ("BAR", "A"), ("HEY", "B")]),
2802
2802
            sorted(list(it)))
2803
2803
 
2804
2804