K2LL33D SHELL

 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 : 104.21.89.46

your ip : 172.70.80.98

H O M E


Filename/usr/lib/python2.7/dist-packages/twisted/python/test/test_urlpath.py
Size1.84 kb
Permissionrw-r--r--
Ownerroot : root
Create time27-Apr-2025 09:56
Last modified28-Aug-2012 00:28
Last accessed27-Apr-2025 09:57
Actionsedit | rename | delete | download (gzip)
Viewtext | code | image
# Copyright (c) Twisted Matrix Laboratories.
# See LICENSE for details.

"""
Tests for L{twisted.python.urlpath}.
"""

from twisted.trial import unittest
from twisted.python import urlpath


class URLPathTestCase(unittest.TestCase):
def setUp(self):
self.path = urlpath.URLPath.fromString("http://example.com/foo/bar?yes=no&no=yes#footer")

def testStringConversion(self):
self.assertEqual(str(self.path), "http://example.com/foo/bar?yes=no&no=yes#footer")

def testChildString(self):
self.assertEqual(str(self.path.child('hello')), "http://example.com/foo/bar/hello")
self.assertEqual(str(self.path.child('hello').child('')), "http://example.com/foo/bar/hello/")

def testSiblingString(self):
self.assertEqual(str(self.path.sibling('baz')), 'http://example.com/foo/baz')

# The sibling of http://example.com/foo/bar/
# is http://example.comf/foo/bar/baz
# because really we are constructing a sibling of
# http://example.com/foo/bar/index.html
self.assertEqual(str(self.path.child('').sibling('baz')), 'http://example.com/foo/bar/baz')

def testParentString(self):
# parent should be equivalent to '..'
# 'foo' is the current directory, '/' is the parent directory
self.assertEqual(str(self.path.parent()), 'http://example.com/')
self.assertEqual(str(self.path.child('').parent()), 'http://example.com/foo/')
self.assertEqual(str(self.path.child('baz').parent()), 'http://example.com/foo/')
self.assertEqual(str(self.path.parent().parent().parent().parent().parent()), 'http://example.com/')

def testHereString(self):
# here should be equivalent to '.'
self.assertEqual(str(self.path.here()), 'http://example.com/foo/')
self.assertEqual(str(self.path.child('').here()), 'http://example.com/foo/bar/')