https://t.me/RX1948
Server : Apache/2.4.18 (Ubuntu)
System : Linux canvaswebdesign 3.13.0-71-generic #114-Ubuntu SMP Tue Dec 1 02:34:22 UTC 2015 x86_64
User : oppastar ( 1041)
PHP Version : 7.0.33-0ubuntu0.16.04.15
Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,
Directory :  /usr/lib/python2.7/dist-packages/twisted/python/test/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : //usr/lib/python2.7/dist-packages/twisted/python/test/test_win32.py
# 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")


    def test_deprecationGetProgramFilesPath(self):
        """
        L{getProgramFilesPath} has been deprecated.
        """
        win32.getProgramFilesPath()

        emittedWarnings = self.flushWarnings(
            [self.test_deprecationGetProgramFilesPath])
        self.assertEqual(len(emittedWarnings), 1)
        self.assertIs(emittedWarnings[0]["category"], DeprecationWarning)
        self.assertEqual(
            emittedWarnings[0]["message"],
            "twisted.python.win32.getProgramFilesPath was deprecated in "
            "Twisted 15.3.0")

    if not platform.isWindows():
        test_deprecationGetProgramFilesPath.skip = (
            "Deprecation test for getProgramFilesPath() is Windows only")


    def test_deprecationGetProgramsMenuPath(self):
        """
        L{getProgramsMenuPath} has been deprecated.
        """
        win32.getProgramsMenuPath()

        emittedWarnings = self.flushWarnings(
            [self.test_deprecationGetProgramsMenuPath])
        self.assertEqual(len(emittedWarnings), 1)
        self.assertIs(emittedWarnings[0]["category"], DeprecationWarning)
        self.assertEqual(
            emittedWarnings[0]["message"],
            "twisted.python.win32.getProgramsMenuPath was deprecated in "
            "Twisted 15.3.0")

https://t.me/RX1948 - 2025