From: Daira Hopwood Date: Thu, 5 Feb 2015 02:22:27 +0000 (+0000) Subject: Test the quotemarks=True and quotemarks=False options of quote_local_unicode_path. X-Git-Tag: allmydata-tahoe-1.10.1a1~73 X-Git-Url: https://git.rkrishnan.org/Site/Content/Exhibitors/module-simplejson.tests.html?a=commitdiff_plain;h=9ac392802b6034aefd4c742ea9dd02813f4667d9;p=tahoe-lafs%2Ftahoe-lafs.git Test the quotemarks=True and quotemarks=False options of quote_local_unicode_path. Signed-off-by: Daira Hopwood --- diff --git a/src/allmydata/test/test_encodingutil.py b/src/allmydata/test/test_encodingutil.py index 4621a196..98156c6f 100644 --- a/src/allmydata/test/test_encodingutil.py +++ b/src/allmydata/test/test_encodingutil.py @@ -405,10 +405,21 @@ class QuotePaths(ReallyEqualMixin, unittest.TestCase): self.failUnlessReallyEqual(quote_path([u'foo', u'\nbar'], quotemarks=True), '"foo/\\x0abar"') self.failUnlessReallyEqual(quote_path([u'foo', u'\nbar'], quotemarks=False), '"foo/\\x0abar"') + def win32_other(win32, other): + return win32 if sys.platform == "win32" else other + self.failUnlessReallyEqual(quote_local_unicode_path(u"\\\\?\\C:\\foo"), - "'C:\\foo'" if sys.platform == "win32" else "'\\\\?\\C:\\foo'") + win32_other("'C:\\foo'", "'\\\\?\\C:\\foo'")) + self.failUnlessReallyEqual(quote_local_unicode_path(u"\\\\?\\C:\\foo", quotemarks=True), + win32_other("'C:\\foo'", "'\\\\?\\C:\\foo'")) + self.failUnlessReallyEqual(quote_local_unicode_path(u"\\\\?\\C:\\foo", quotemarks=False), + win32_other("C:\\foo", "\\\\?\\C:\\foo")) self.failUnlessReallyEqual(quote_local_unicode_path(u"\\\\?\\UNC\\foo\\bar"), - "'\\\\foo\\bar'" if sys.platform == "win32" else "'\\\\?\\UNC\\foo\\bar'") + win32_other("'\\\\foo\\bar'", "'\\\\?\\UNC\\foo\\bar'")) + self.failUnlessReallyEqual(quote_local_unicode_path(u"\\\\?\\UNC\\foo\\bar", quotemarks=True), + win32_other("'\\\\foo\\bar'", "'\\\\?\\UNC\\foo\\bar'")) + self.failUnlessReallyEqual(quote_local_unicode_path(u"\\\\?\\UNC\\foo\\bar", quotemarks=False), + win32_other("\\\\foo\\bar", "\\\\?\\UNC\\foo\\bar")) class UbuntuKarmicUTF8(EncodingUtil, unittest.TestCase):