403Webshell
Server IP : 61.19.30.66  /  Your IP : 216.73.216.15
Web Server : Apache/2.2.22 (Ubuntu)
System : Linux klw 3.11.0-15-generic #25~precise1-Ubuntu SMP Thu Jan 30 17:39:31 UTC 2014 x86_64
User : www-data ( 33)
PHP Version : 5.3.10-1ubuntu3.48
Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,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,
MySQL : ON  |  cURL : OFF  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : ON  |  Pkexec : OFF
Directory :  /usr/share/pyshared/keyring/tests/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /usr/share/pyshared/keyring/tests/test_util.py
# -*- coding: utf-8 -*-

"""
Test for simple escape/unescape routine
"""


import unittest

from keyring.util import escape

class EscapeTestCase(unittest.TestCase):

    def check_escape_unescape(self, initial):
        escaped = escape.escape(initial)
        self.assertTrue(all(c in (escape.LEGAL_CHARS + '_') for c in escaped))
        unescaped = escape.unescape(escaped)
        self.assertEqual(initial, unescaped)

    def test_escape_unescape(self):
        self.check_escape_unescape("aaaa")
        self.check_escape_unescape("aaaa bbbb cccc")
        self.check_escape_unescape(u"Zażółć gęślą jaźń")
        self.check_escape_unescape("(((P{{{{'''---; ;; '\"|%^")

    def test_low_byte(self):
        """
        Ensure that encoding low bytes (ordinal less than hex F) encode as
        as three bytes to avoid ambiguity. For example '\n' (hex A) should
        encode as '_0A' and not '_A', the latter of which
        isn't matched by the inverse operation.
        """
        self.check_escape_unescape('\n')
        self.check_escape_unescape('\x000')

def test_suite():
    suite = unittest.TestSuite()
    suite.addTest(unittest.makeSuite(EscapeTestCase))
    return suite

if __name__ == "__main__":
    unittest.main(defaultTest="test_suite")

Youez - 2016 - github.com/yon3zu
LinuXploit