/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to breezy/tests/test_osutils.py

  • Committer: Breezy landing bot
  • Author(s): Jelmer Vernooij
  • Date: 2017-05-30 21:24:59 UTC
  • mfrom: (6630.1.4 deprecation)
  • Revision ID: breezy.the.bot@gmail.com-20170530212459-7n9a7isyb3nbim9y
Remove all deprecated arguments, functions and methods.

Merged from https://code.launchpad.net/~jelmer/brz/deprecation/+merge/324814

Show diffs side-by-side

added added

removed removed

Lines of Context:
829
829
        self.assertEqual('foobar', osutils.safe_revision_id('foobar'))
830
830
 
831
831
    def test_from_unicode_string_ascii_contents(self):
832
 
        self.assertEqual('bargam',
833
 
                         osutils.safe_revision_id(u'bargam', warn=False))
834
 
 
835
 
    def test_from_unicode_deprecated(self):
836
 
        self.assertEqual('bargam',
837
 
            self.callDeprecated([osutils._revision_id_warning],
838
 
                                osutils.safe_revision_id, u'bargam'))
 
832
        self.assertRaises(TypeError,
 
833
                          osutils.safe_revision_id, u'bargam')
839
834
 
840
835
    def test_from_unicode_string_unicode_contents(self):
841
 
        self.assertEqual('bargam\xc2\xae',
842
 
                         osutils.safe_revision_id(u'bargam\xae', warn=False))
 
836
        self.assertRaises(TypeError,
 
837
                         osutils.safe_revision_id, u'bargam\xae')
843
838
 
844
839
    def test_from_utf8_string(self):
845
840
        self.assertEqual('foo\xc2\xae',
856
851
        self.assertEqual('foobar', osutils.safe_file_id('foobar'))
857
852
 
858
853
    def test_from_unicode_string_ascii_contents(self):
859
 
        self.assertEqual('bargam', osutils.safe_file_id(u'bargam', warn=False))
860
 
 
861
 
    def test_from_unicode_deprecated(self):
862
 
        self.assertEqual('bargam',
863
 
            self.callDeprecated([osutils._file_id_warning],
864
 
                                osutils.safe_file_id, u'bargam'))
 
854
        self.assertRaises(TypeError, osutils.safe_file_id, u'bargam')
865
855
 
866
856
    def test_from_unicode_string_unicode_contents(self):
867
 
        self.assertEqual('bargam\xc2\xae',
868
 
                         osutils.safe_file_id(u'bargam\xae', warn=False))
 
857
        self.assertRaises(TypeError,
 
858
                          osutils.safe_file_id, u'bargam\xae')
869
859
 
870
860
    def test_from_utf8_string(self):
871
861
        self.assertEqual('foo\xc2\xae',
1831
1821
        self.assertRaises(IOError, osutils.resource_string, 'breezy', 'yyy.xx')
1832
1822
 
1833
1823
 
1834
 
class TestReCompile(tests.TestCase):
1835
 
 
1836
 
    def _deprecated_re_compile_checked(self, *args, **kwargs):
1837
 
        return self.applyDeprecated(symbol_versioning.deprecated_in((2, 2, 0)),
1838
 
            osutils.re_compile_checked, *args, **kwargs)
1839
 
 
1840
 
    def test_re_compile_checked(self):
1841
 
        r = self._deprecated_re_compile_checked(r'A*', re.IGNORECASE)
1842
 
        self.assertTrue(r.match('aaaa'))
1843
 
        self.assertTrue(r.match('aAaA'))
1844
 
 
1845
 
    def test_re_compile_checked_error(self):
1846
 
        # like https://bugs.launchpad.net/bzr/+bug/251352
1847
 
 
1848
 
        # Due to possible test isolation error, re.compile is not lazy at
1849
 
        # this point. We re-install lazy compile.
1850
 
        lazy_regex.install_lazy_compile()
1851
 
        err = self.assertRaises(
1852
 
            errors.BzrCommandError,
1853
 
            self._deprecated_re_compile_checked, '*', re.IGNORECASE, 'test case')
1854
 
        self.assertEqual(
1855
 
            'Invalid regular expression in test case: '
1856
 
            '"*" nothing to repeat',
1857
 
            str(err))
1858
 
 
1859
 
 
1860
1824
class TestDirReader(tests.TestCaseInTempDir):
1861
1825
 
1862
1826
    scenarios = dir_reader_scenarios()