863
861
self.assertEqual('//HOST/path', osutils._win98_abspath('//HOST/path'))
865
863
cwd = osutils.getcwd().rstrip('/')
866
drive = osutils.ntpath.splitdrive(cwd)[0]
864
drive = osutils._nt_splitdrive(cwd)[0]
867
865
self.assertEqual(cwd+'/path', osutils._win98_abspath('path'))
868
866
self.assertEqual(drive+'/path', osutils._win98_abspath('/path'))
1708
1706
class TestReCompile(tests.TestCase):
1710
def _deprecated_re_compile_checked(self, *args, **kwargs):
1711
return self.applyDeprecated(symbol_versioning.deprecated_in((2, 2, 0)),
1712
osutils.re_compile_checked, *args, **kwargs)
1714
1708
def test_re_compile_checked(self):
1715
r = self._deprecated_re_compile_checked(r'A*', re.IGNORECASE)
1709
r = osutils.re_compile_checked(r'A*', re.IGNORECASE)
1716
1710
self.assertTrue(r.match('aaaa'))
1717
1711
self.assertTrue(r.match('aAaA'))
1719
1713
def test_re_compile_checked_error(self):
1720
1714
# like https://bugs.launchpad.net/bzr/+bug/251352
1722
# Due to possible test isolation error, re.compile is not lazy at
1723
# this point. We re-install lazy compile.
1724
lazy_regex.install_lazy_compile()
1725
1715
err = self.assertRaises(
1726
1716
errors.BzrCommandError,
1727
self._deprecated_re_compile_checked, '*', re.IGNORECASE, 'test case')
1717
osutils.re_compile_checked, '*', re.IGNORECASE, 'test case')
1728
1718
self.assertEqual(
1729
'Invalid regular expression in test case: '
1730
'"*" nothing to repeat',
1719
"Invalid regular expression in test case: '*': "
1720
"nothing to repeat",