Apache/2.4.7 (Ubuntu) Linux sman1baleendah 3.13.0-24-generic #46-Ubuntu SMP Thu Apr 10 19:11:08 UTC 2014 x86_64 uid=33(www-data) gid=33(www-data) groups=33(www-data) safemode : OFF MySQL: ON | Perl: ON | cURL: OFF | WGet: ON > / usr / lib / python2.7 / dist-packages / twisted / python / test / | server ip : 172.67.156.115 your ip : 172.70.80.98 H O M E |
Filename | /usr/lib/python2.7/dist-packages/twisted/python/test/test_win32.py |
Size | 1.96 kb |
Permission | rw-r--r-- |
Owner | root : root |
Create time | 27-Apr-2025 09:56 |
Last modified | 21-Feb-2013 20:50 |
Last accessed | 27-Apr-2025 09:57 |
Actions | edit | rename | delete | download (gzip) |
View | text | code | image |
# Copyright (c) Twisted Matrix Laboratories.
# See LICENSE for details.
"""
Tests for L{twisted.python.win32}.
"""
from twisted.trial import unittest
from twisted.python.runtime import platform
from twisted.python import win32
class CommandLineQuotingTests(unittest.TestCase):
"""
Tests for L{cmdLineQuote}.
"""
def test_argWithoutSpaces(self):
"""
Calling C{cmdLineQuote} with an argument with no spaces should
return the argument unchanged.
"""
self.assertEqual(win32.cmdLineQuote('an_argument'), 'an_argument')
def test_argWithSpaces(self):
"""
Calling C{cmdLineQuote} with an argument containing spaces should
return the argument surrounded by quotes.
"""
self.assertEqual(win32.cmdLineQuote('An Argument'), '"An Argument"')
def test_emptyStringArg(self):
"""
Calling C{cmdLineQuote} with an empty string should return a
quoted empty string.
"""
self.assertEqual(win32.cmdLineQuote(''), '""')
class ProgramPathsTests(unittest.TestCase):
"""
Tests for L{getProgramsMenuPath} and L{getProgramFilesPath}.
"""
def test_getProgramsMenuPath(self):
"""
L{getProgramsMenuPath} guesses the programs menu path on non-win32
platforms. On non-win32 it will try to figure out the path by
examining the registry.
"""
if not platform.isWindows():
self.assertEqual(win32.getProgramsMenuPath(),
"C:\\Windows\\Start Menu\\Programs")
else:
self.assertIsInstance(win32.getProgramsMenuPath(), str)
def test_getProgramFilesPath(self):
"""
L{getProgramFilesPath} returns the "program files" path on win32.
"""
self.assertIsInstance(win32.getProgramFilesPath(), str)
if not platform.isWindows():
test_getProgramFilesPath.skip = (
"Cannot figure out the program files path on non-win32 platform")
# See LICENSE for details.
"""
Tests for L{twisted.python.win32}.
"""
from twisted.trial import unittest
from twisted.python.runtime import platform
from twisted.python import win32
class CommandLineQuotingTests(unittest.TestCase):
"""
Tests for L{cmdLineQuote}.
"""
def test_argWithoutSpaces(self):
"""
Calling C{cmdLineQuote} with an argument with no spaces should
return the argument unchanged.
"""
self.assertEqual(win32.cmdLineQuote('an_argument'), 'an_argument')
def test_argWithSpaces(self):
"""
Calling C{cmdLineQuote} with an argument containing spaces should
return the argument surrounded by quotes.
"""
self.assertEqual(win32.cmdLineQuote('An Argument'), '"An Argument"')
def test_emptyStringArg(self):
"""
Calling C{cmdLineQuote} with an empty string should return a
quoted empty string.
"""
self.assertEqual(win32.cmdLineQuote(''), '""')
class ProgramPathsTests(unittest.TestCase):
"""
Tests for L{getProgramsMenuPath} and L{getProgramFilesPath}.
"""
def test_getProgramsMenuPath(self):
"""
L{getProgramsMenuPath} guesses the programs menu path on non-win32
platforms. On non-win32 it will try to figure out the path by
examining the registry.
"""
if not platform.isWindows():
self.assertEqual(win32.getProgramsMenuPath(),
"C:\\Windows\\Start Menu\\Programs")
else:
self.assertIsInstance(win32.getProgramsMenuPath(), str)
def test_getProgramFilesPath(self):
"""
L{getProgramFilesPath} returns the "program files" path on win32.
"""
self.assertIsInstance(win32.getProgramFilesPath(), str)
if not platform.isWindows():
test_getProgramFilesPath.skip = (
"Cannot figure out the program files path on non-win32 platform")