Changeset 403

Show
Ignore:
Timestamp:
01/15/03 11:36:15 (6 years ago)
Author:
sholloway
Message:

*** empty log message ***

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/RBFoundation/RBFoundation/XMLClassBuilder.py

    r396 r403  
    4444    #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 
    4545 
     46    class Raise(object): 
     47        def __init__(self, exception=KeyError, message=''): 
     48            self.exception = exception 
     49            self.message = message 
     50 
     51        def __call__(self, *args, **kw): 
     52            raise self.exception, self.message 
     53 
     54    #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 
     55 
    4656    class InheritFromNextFactory(Exception): 
    4757        def __call__(self, *args, **kw): 
    48             raise InheritFromNextFactory, (args, kw) 
     58            raise self.__class__, (args, kw) 
    4959 
    5060    #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 
  • trunk/RBFoundation/test/test_URIparser.py

    r394 r403  
    2929import unittest 
    3030 
    31 from Foundation import URIparser 
     31from RBFoundation import URIparser 
    3232 
    3333#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 
     
    3636 
    3737class URIPathDefaultTestCase(unittest.TestCase): 
     38    def verifyURIParts(self, uri, scheme, authority, path, query, fragment): 
     39        self.failUnlessEqual(uri.scheme, scheme) 
     40        self.failUnlessEqual(uri.authority, authority) 
     41        self.failUnlessEqual(uri.path, path) 
     42        self.failUnlessEqual(uri.query, query) 
     43        self.failUnlessEqual(uri.fragment, fragment) 
     44 
    3845    def testScheme(self): 
    39         """Testing <scheme:>""" 
     46        'Path Default: "scheme:"' 
    4047        URIstr = 'scheme:' 
    41  
    42         uri = URIparser.URIPathDefault(URIstr) 
    43         self.failUnlessEqual(uri.uri, URIstr) 
    44  
    45         self.failUnlessEqual(uri.scheme, 'scheme') 
    46         self.failUnlessEqual(uri.authority, None) 
    47         self.failUnlessEqual(uri.path, '') 
    48         self.failUnlessEqual(uri.query, None) 
    49         self.failUnlessEqual(uri.fragment, None) 
     48        uri = URIparser.URIPathDefault(URIstr) 
     49        self.failUnlessEqual(uri.uri, URIstr) 
     50        self.verifyURIParts(uri, 'scheme', None, '', None, None) 
    5051 
    5152    def testPath(self): 
    52         """Testing <pathvalue>""" 
    53         URIstr = 'pathvalue' 
    54  
    55         uri = URIparser.URIPathDefault(URIstr) 
    56         self.failUnlessEqual(uri.uri, URIstr) 
    57  
    58         self.failUnlessEqual(uri.scheme, None) 
    59         self.failUnlessEqual(uri.authority, None) 
    60         self.failUnlessEqual(uri.path, 'pathvalue') 
    61         self.failUnlessEqual(uri.query, None) 
    62         self.failUnlessEqual(uri.fragment, None) 
    63  
    64 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 
    65  
    66 #class URIAuthorityDefaultTestCase(unittest.TestCase): 
    67 #    def test(self): 
    68 #        pass 
     53        'Path Default: "path"' 
     54        URIstr = 'path' 
     55        uri = URIparser.URIPathDefault(URIstr) 
     56        self.failUnlessEqual(uri.uri, URIstr) 
     57        self.verifyURIParts(uri, None, None, 'path', None, None) 
     58 
     59    def testPathSlash(self): 
     60        'Path Default: "/path"' 
     61        URIstr = '/path' 
     62        uri = URIparser.URIPathDefault(URIstr) 
     63        self.failUnlessEqual(uri.uri, URIstr) 
     64        self.verifyURIParts(uri, None, None, '/path', None, None) 
     65 
     66    def testSchemePath(self): 
     67        'Path Default: "scheme:path"' 
     68        URIstr = 'scheme:path' 
     69        uri = URIparser.URIPathDefault(URIstr) 
     70        self.failUnlessEqual(uri.uri, URIstr) 
     71        self.verifyURIParts(uri, 'scheme', None, 'path', None, None) 
     72 
     73    def testSchemePathSlash(self): 
     74        'Path Default: "scheme:/path"' 
     75        URIstr = 'scheme:/path' 
     76        uri = URIparser.URIPathDefault(URIstr) 
     77        self.failUnlessEqual(uri.uri, URIstr) 
     78        self.verifyURIParts(uri, 'scheme', None, '/path', None, None) 
     79 
     80    def testAuthority(self): 
     81        'Path Default: "//authority"' 
     82        URIstr = '//authority' 
     83        uri = URIparser.URIPathDefault(URIstr) 
     84        self.failUnlessEqual(uri.uri, URIstr) 
     85        self.verifyURIParts(uri, None, 'authority', '', None, None) 
     86 
     87    def testSchemeAuthority(self): 
     88        'Path Default: "scheme://authority"' 
     89        URIstr = 'scheme://authority' 
     90        uri = URIparser.URIPathDefault(URIstr) 
     91        self.failUnlessEqual(uri.uri, URIstr) 
     92        self.verifyURIParts(uri, 'scheme', 'authority', '', None, None) 
     93 
     94    def testAuthorityPath(self): 
     95        'Path Default: "//authority/path"' 
     96        URIstr = '//authority/path' 
     97        uri = URIparser.URIPathDefault(URIstr) 
     98        self.failUnlessEqual(uri.uri, URIstr) 
     99        self.verifyURIParts(uri, None, 'authority', '/path', None, None) 
     100 
     101    def testSchemeAuthorityPath(self): 
     102        'Path Default: "scheme://authority/path"' 
     103        URIstr = 'scheme://authority/path' 
     104        uri = URIparser.URIPathDefault(URIstr) 
     105        self.failUnlessEqual(uri.uri, URIstr) 
     106        self.verifyURIParts(uri, 'scheme', 'authority', '/path', None, None) 
     107 
     108    def testUserAuthorityPath(self): 
     109        'Path Default: "//user@authority/path"' 
     110        URIstr = '//user@authority/path' 
     111        uri = URIparser.URIPathDefault(URIstr) 
     112        self.failUnlessEqual(uri.uri, URIstr) 
     113        self.verifyURIParts(uri, None, 'user@authority', '/path', None, None) 
     114 
     115    def testSchemeUserAuthorityPath(self): 
     116        'Path Default: "scheme://user@authority/path"' 
     117        URIstr = 'scheme://user@authority/path' 
     118        uri = URIparser.URIPathDefault(URIstr) 
     119        self.failUnlessEqual(uri.uri, URIstr) 
     120        self.verifyURIParts(uri, 'scheme', 'user@authority', '/path', None, None) 
     121 
     122    def testSchemeUserAuthorityHostPath(self): 
     123        'Path Default: "scheme://user@authority:4242/path"' 
     124        URIstr = 'scheme://user@authority:4242/path' 
     125        uri = URIparser.URIPathDefault(URIstr) 
     126        self.failUnlessEqual(uri.uri, URIstr) 
     127        self.verifyURIParts(uri, 'scheme', 'user@authority:4242', '/path', None, None) 
     128 
     129    def testMailto(self): 
     130        'Path Default: "mailto:user@host"' 
     131        URIstr = 'mailto:user@host' 
     132        uri = URIparser.URIPathDefault(URIstr) 
     133        self.failUnlessEqual(uri.uri, URIstr) 
     134        self.verifyURIParts(uri, 'mailto', None, 'user@host', None, None) 
     135 
     136    def testUserPasswdAuthority(self): 
     137        'Path Default: "//user:passwd@authority"' 
     138        URIstr = '//user:passwd@authority' 
     139        uri = URIparser.URIPathDefault(URIstr) 
     140        self.failUnlessEqual(uri.uri, URIstr) 
     141        self.verifyURIParts(uri, None, 'user:passwd@authority', '', None, None) 
     142 
     143    def testUserPasswdAuthorityHostPath(self): 
     144        'Path Default: "//user:passwd@authority:4242/path"' 
     145        URIstr = '//user:passwd@authority:4242/path' 
     146        uri = URIparser.URIPathDefault(URIstr) 
     147        self.failUnlessEqual(uri.uri, URIstr) 
     148        self.verifyURIParts(uri, None, 'user:passwd@authority:4242', '/path', None, None) 
     149 
     150    def testSchemeUserPasswdAuthorityHostPath(self): 
     151        'Path Default: "scheme://user:passwd@authority:4242/path"' 
     152        URIstr = 'scheme://user:passwd@authority:4242/path' 
     153        uri = URIparser.URIPathDefault(URIstr) 
     154        self.failUnlessEqual(uri.uri, URIstr) 
     155        self.verifyURIParts(uri, 'scheme', 'user:passwd@authority:4242', '/path', None, None) 
     156 
     157    def testSchemeUserPasswdAuthorityHostPathAttributes(self): 
     158        'Path Default: "scheme://user:passwd@authority:4242/path;attr1=value1"' 
     159        URIstr = 'scheme://user:passwd@authority:4242/path;attr1=value1' 
     160        uri = URIparser.URIPathDefault(URIstr) 
     161        self.failUnlessEqual(uri.uri, URIstr) 
     162        self.verifyURIParts(uri, 'scheme', 'user:passwd@authority:4242', '/path;attr1=value1', None, None) 
     163 
     164    def testSchemeUserPasswdAuthorityHostPathAttributesQuery(self): 
     165        'Path Default: "scheme://user:passwd@authority:4242/path;attr1=value1?query"' 
     166        URIstr = 'scheme://user:passwd@authority:4242/path;attr1=value1?query' 
     167        uri = URIparser.URIPathDefault(URIstr) 
     168        self.failUnlessEqual(uri.uri, URIstr) 
     169        self.verifyURIParts(uri, 'scheme', 'user:passwd@authority:4242', '/path;attr1=value1', 'query', None) 
     170 
     171    def testSchemeUserPasswdAuthorityHostPathAttributesQueryFragment(self): 
     172        'Path Default: "scheme://user:passwd@authority:4242/path;attr1=value1?query#fragment"' 
     173        URIstr = 'scheme://user:passwd@authority:4242/path;attr1=value1?query#fragment' 
     174        uri = URIparser.URIPathDefault(URIstr) 
     175        self.failUnlessEqual(uri.uri, URIstr) 
     176        self.verifyURIParts(uri, 'scheme', 'user:passwd@authority:4242', '/path;attr1=value1', 'query', 'fragment') 
     177 
     178    def testSchemeNullAuthorityPathAttributesQueryFragment(self): 
     179        'Path Default: "scheme:///path;attr1=value1?query#fragment"' 
     180        URIstr = 'scheme:///path;attr1=value1?query#fragment' 
     181        uri = URIparser.URIPathDefault(URIstr) 
     182        self.failUnlessEqual(uri.uri, URIstr) 
     183        self.verifyURIParts(uri, 'scheme', '', '/path;attr1=value1', 'query', 'fragment') 
     184 
     185    def testSchemePathAttributesQueryFragment(self): 
     186        'Path Default: "scheme:/path;attr1=value1?query#fragment"' 
     187        URIstr = 'scheme:/path;attr1=value1?query#fragment' 
     188        uri = URIparser.URIPathDefault(URIstr) 
     189        self.failUnlessEqual(uri.uri, URIstr) 
     190        self.verifyURIParts(uri, 'scheme', None, '/path;attr1=value1', 'query', 'fragment') 
     191 
     192    def testNullAuthorityPathAttributesQueryFragment(self): 
     193        'Path Default: "///path;attr1=value1?query#fragment"' 
     194        URIstr = '///path;attr1=value1?query#fragment' 
     195        uri = URIparser.URIPathDefault(URIstr) 
     196        self.failUnlessEqual(uri.uri, URIstr) 
     197        self.verifyURIParts(uri, None, '', '/path;attr1=value1', 'query', 'fragment') 
     198 
     199    def testPathAttributesQueryFragment(self): 
     200        'Path Default: "/path;attr1=value1?query#fragment"' 
     201        URIstr = '/path;attr1=value1?query#fragment' 
     202        uri = URIparser.URIPathDefault(URIstr) 
     203        self.failUnlessEqual(uri.uri, URIstr) 
     204        self.verifyURIParts(uri, None, None, '/path;attr1=value1', 'query', 'fragment') 
     205 
     206    def testPathQueryFragment(self): 
     207        'Path Default: "/path?query#fragment"' 
     208        URIstr = '/path?query#fragment' 
     209        uri = URIparser.URIPathDefault(URIstr) 
     210        self.failUnlessEqual(uri.uri, URIstr) 
     211        self.verifyURIParts(uri, None, None, '/path', 'query', 'fragment') 
     212 
     213    def testQueryFragment(self): 
     214        'Path Default: "?query#fragment"' 
     215        URIstr = '?query#fragment' 
     216        uri = URIparser.URIPathDefault(URIstr) 
     217        self.failUnlessEqual(uri.uri, URIstr) 
     218        self.verifyURIParts(uri, None, None, '', 'query', 'fragment') 
     219 
     220    def testSchemeQuery(self): 
     221        'Path Default: "scheme:?query"' 
     222        URIstr = 'scheme:?query' 
     223        uri = URIparser.URIPathDefault(URIstr) 
     224        self.failUnlessEqual(uri.uri, URIstr) 
     225        self.verifyURIParts(uri, 'scheme', None, '', 'query', None) 
     226 
     227    def testQuery(self): 
     228        'Path Default: "?query"' 
     229        URIstr = '?query' 
     230        uri = URIparser.URIPathDefault(URIstr) 
     231        self.failUnlessEqual(uri.uri, URIstr) 
     232        self.verifyURIParts(uri, None, None, '', 'query', None) 
     233 
     234    def testFragment(self): 
     235        'Path Default: "#fragment"' 
     236        URIstr = '#fragment' 
     237        uri = URIparser.URIPathDefault(URIstr) 
     238        self.failUnlessEqual(uri.uri, URIstr) 
     239        self.verifyURIParts(uri, None, None, '', None, 'fragment') 
     240 
     241    def testSchemeFragment(self): 
     242        'Path Default: "scheme:#fragment"' 
     243        URIstr = 'scheme:#fragment' 
     244        uri = URIparser.URIPathDefault(URIstr) 
     245        self.failUnlessEqual(uri.uri, URIstr) 
     246        self.verifyURIParts(uri, 'scheme', None, '', None, 'fragment') 
     247 
     248    def testPathQuery(self): 
     249        'Path Default: "/path?query"' 
     250        URIstr = '/path?query' 
     251        uri = URIparser.URIPathDefault(URIstr) 
     252        self.failUnlessEqual(uri.uri, URIstr) 
     253        self.verifyURIParts(uri, None, None, '/path', 'query', None) 
     254 
     255    def testPathFragment(self): 
     256        'Path Default: "/path#fragment"' 
     257        URIstr = '/path#fragment' 
     258        uri = URIparser.URIPathDefault(URIstr) 
     259        self.failUnlessEqual(uri.uri, URIstr) 
     260        self.verifyURIParts(uri, None, None, '/path', None, 'fragment') 
     261 
     262#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 
     263 
     264class URIAuthorityDefaultTestCase(unittest.TestCase): 
     265    def verifyURIParts(self, uri, scheme, authority, path, query, fragment): 
     266        self.failUnlessEqual(uri.scheme, scheme) 
     267        self.failUnlessEqual(uri.authority, authority) 
     268        self.failUnlessEqual(uri.path, path) 
     269        self.failUnlessEqual(uri.query, query) 
     270        self.failUnlessEqual(uri.fragment, fragment) 
     271 
     272    def testScheme(self): 
     273        'Authority Default: "scheme:"' 
     274        URIstr = 'scheme:' 
     275        uri = URIparser.URIAuthorityDefault(URIstr) 
     276        self.failUnlessEqual(uri.uri, URIstr) 
     277        self.verifyURIParts(uri, 'scheme', '', None, None, None) 
     278 
     279    def testAuthority(self): 
     280        'Authority Default: "authority"' 
     281        URIstr = 'authority' 
     282        uri = URIparser.URIAuthorityDefault(URIstr) 
     283        self.failUnlessEqual(uri.uri, URIstr) 
     284        self.verifyURIParts(uri, None, 'authority', None, None, None) 
     285 
     286    def testPath(self): 
     287        'Authority Default: "/path"' 
     288        URIstr = '/path' 
     289        uri = URIparser.URIAuthorityDefault(URIstr) 
     290        self.failUnlessEqual(uri.uri, URIstr) 
     291        self.verifyURIParts(uri, None, '', '/path', None, None) 
     292 
     293    def testSchemeAuthority(self): 
     294        'Authority Default: "scheme:authority"' 
     295        URIstr = 'scheme:authority' 
     296        uri = URIparser.URIAuthorityDefault(URIstr) 
     297        self.failUnlessEqual(uri.uri, URIstr) 
     298        self.verifyURIParts(uri, 'scheme', 'authority', None, None, None) 
     299 
     300    def testSchemePath(self): 
     301        'Authority Default: "scheme:/path"' 
     302        URIstr = 'scheme:/path' 
     303        uri = URIparser.URIAuthorityDefault(URIstr) 
     304        self.failUnlessEqual(uri.uri, URIstr) 
     305        self.verifyURIParts(uri, 'scheme', '', '/path', None, None) 
     306 
     307    def testNetworkAuthority(self): 
     308        'Authority Default: "//authority"' 
     309        URIstr = '//authority' 
     310        uri = URIparser.URIAuthorityDefault(URIstr) 
     311        self.failUnlessEqual(uri.uri, URIstr) 
     312        self.verifyURIParts(uri, None, 'authority', None, None, None) 
     313 
     314    def testSchemeNetworkAuthority(self): 
     315        'Authority Default: "scheme://authority"' 
     316        URIstr = 'scheme://authority' 
     317        uri = URIparser.URIAuthorityDefault(URIstr) 
     318        self.failUnlessEqual(uri.uri, URIstr) 
     319        self.verifyURIParts(uri, 'scheme', 'authority', None, None, None) 
     320 
     321    def testAuthorityPath(self): 
     322        'Authority Default: "authority/path"' 
     323        URIstr = 'authority/path' 
     324        uri = URIparser.URIAuthorityDefault(URIstr) 
     325        self.failUnlessEqual(uri.uri, URIstr) 
     326        self.verifyURIParts(uri, None, 'authority', '/path', None, None) 
     327 
     328    def testNetworkAuthorityPath(self): 
     329        'Authority Default: "//authority/path"' 
     330        URIstr = '//authority/path' 
     331        uri = URIparser.URIAuthorityDefault(URIstr) 
     332        self.failUnlessEqual(uri.uri, URIstr) 
     333        self.verifyURIParts(uri, None, 'authority', '/path', None, None) 
     334 
     335    def testSchemeAuthorityPath(self): 
     336        'Authority Default: "scheme:authority/path"' 
     337        URIstr = 'scheme:authority/path' 
     338        uri = URIparser.URIAuthorityDefault(URIstr) 
     339        self.failUnlessEqual(uri.uri, URIstr) 
     340        self.verifyURIParts(uri, 'scheme', 'authority', '/path', None, None) 
     341 
     342    def testSchemeNetworkAuthorityPath(self): 
     343        'Authority Default: "scheme://authority/path"' 
     344        URIstr = 'scheme://authority/path' 
     345        uri = URIparser.URIAuthorityDefault(URIstr) 
     346        self.failUnlessEqual(uri.uri, URIstr) 
     347        self.verifyURIParts(uri, 'scheme', 'authority', '/path', None, None) 
     348 
     349    def testNetworkUserAuthorityPath(self): 
     350        'Authority Default: "//user@authority/path"' 
     351        URIstr = '//user@authority/path' 
     352        uri = URIparser.URIAuthorityDefault(URIstr) 
     353        self.failUnlessEqual(uri.uri, URIstr) 
     354        self.verifyURIParts(uri, None, 'user@authority', '/path', None, None) 
     355 
     356    def testUserAuthorityPath(self): 
     357        'Authority Default: "user@authority/path"' 
     358        URIstr = 'user@authority/path' 
     359        uri = URIparser.URIAuthorityDefault(URIstr) 
     360        self.failUnlessEqual(uri.uri, URIstr) 
     361        self.verifyURIParts(uri, None, 'user@authority', '/path', None, None) 
     362 
     363    def testSchemeUserAuthorityPath(self): 
     364        'Authority Default: "scheme:user@authority/path"' 
     365        URIstr = 'scheme:user@authority/path' 
     366        uri = URIparser.URIAuthorityDefault(URIstr) 
     367        self.failUnlessEqual(uri.uri, URIstr) 
     368        self.verifyURIParts(uri, 'scheme', 'user@authority', '/path', None, None) 
     369 
     370    def testSchemeNetworkUserAuthorityPath(self): 
     371        'Authority Default: "scheme://user@authority/path"' 
     372        URIstr = 'scheme://user@authority/path' 
     373        uri = URIparser.URIAuthorityDefault(URIstr) 
     374        self.failUnlessEqual(uri.uri, URIstr) 
     375        self.verifyURIParts(uri, 'scheme', 'user@authority', '/path', None, None) 
     376 
     377    def testSchemeNetworkUserAuthorityHostPath(self): 
     378        'Authority Default: "scheme://user@authority:4242/path"' 
     379        URIstr = 'scheme://user@authority:4242/path' 
     380        uri = URIparser.URIAuthorityDefault(URIstr) 
     381        self.failUnlessEqual(uri.uri, URIstr) 
     382        self.verifyURIParts(uri, 'scheme', 'user@authority:4242', '/path', None, None) 
     383 
     384    def testSchemeUserAuthorityHostPath(self): 
     385        'Authority Default: "scheme:user@authority:4242/path"' 
     386        URIstr = 'scheme:user@authority:4242/path' 
     387        uri = URIparser.URIAuthorityDefault(URIstr) 
     388        self.failUnlessEqual(uri.uri, URIstr) 
     389        self.verifyURIParts(uri, 'scheme', 'user@authority:4242', '/path', None, None) 
     390 
     391    def testMailto(self): 
     392        'Authority Default: "mailto:user@host"' 
     393        URIstr = 'mailto:user@host' 
     394        uri = URIparser.URIAuthorityDefault(URIstr) 
     395        self.failUnlessEqual(uri.uri, URIstr) 
     396        self.verifyURIParts(uri, 'mailto', 'user@host', None, None, None) 
     397 
     398    def testNetworkUserPasswdAuthority(self): 
     399        'Authority Default: "//user:passwd@authority"' 
     400        URIstr = '//user:passwd@authority' 
     401        uri = URIparser.URIAuthorityDefault(URIstr) 
     402        self.failUnlessEqual(uri.uri, URIstr) 
     403        self.verifyURIParts(uri, None, 'user:passwd@authority', None, None, None) 
     404 
     405    def testNetworkUserPasswdAuthorityHostPath(self): 
     406        'Authority Default: "//user:passwd@authority:4242/path"' 
     407        URIstr = '//user:passwd@authority:4242/path' 
     408        uri = URIparser.URIAuthorityDefault(URIstr) 
     409        self.failUnlessEqual(uri.uri, URIstr) 
     410        self.verifyURIParts(uri, None, 'user:passwd@authority:4242', '/path', None, None) 
     411 
     412    def testSchemeNetworkUserPasswdAuthorityHostPath(self): 
     413        'Authority Default: "scheme://user:passwd@authority:4242/path"' 
     414        URIstr = 'scheme://user:passwd@authority:4242/path' 
     415        uri = URIparser.URIAuthorityDefault(URIstr) 
     416        self.failUnlessEqual(uri.uri, URIstr) 
     417        self.verifyURIParts(uri, 'scheme', 'user:passwd@authority:4242', '/path', None, None) 
     418 
     419    def testSchemeUserPasswdAuthorityHostPath(self): 
     420        'Authority Default: "scheme:user:passwd@authority:4242/path"' 
     421        URIstr = 'scheme:user:passwd@authority:4242/path' 
     422        uri = URIparser.URIAuthorityDefault(URIstr) 
     423        self.failUnlessEqual(uri.uri, URIstr) 
     424        self.verifyURIParts(uri, 'scheme', 'user:passwd@authority:4242', '/path', None, None) 
     425 
     426    def testSchemeNetworkUserPasswdAuthorityHostPathAttributes(self): 
     427        'Authority Default: "scheme://user:passwd@authority:4242/path;attr1=value1"' 
     428        URIstr = 'scheme://user:passwd@authority:4242/path;attr1=value1' 
     429        uri = URIparser.URIAuthorityDefault(URIstr) 
     430        self.failUnlessEqual(uri.uri, URIstr) 
     431        self.verifyURIParts(uri, 'scheme', 'user:passwd@authority:4242', '/path;attr1=value1', None, None) 
     432 
     433    def testSchemeUserPasswdAuthorityHostPathAttributes(self): 
     434        'Authority Default: "scheme:user:passwd@authority:4242/path;attr1=value1"' 
     435        URIstr = 'scheme:user:passwd@authority:4242/path;attr1=value1' 
     436        uri = URIparser.URIAuthorityDefault(URIstr) 
     437        self.failUnlessEqual(uri.uri, URIstr) 
     438        self.verifyURIParts(uri, 'scheme', 'user:passwd@authority:4242', '/path;attr1=value1', None, None) 
     439 
     440    def testSchemeNetworkUserPasswdAuthorityHostPathAttributesQuery(self): 
     441        'Authority Default: "scheme://user:passwd@authority:4242/path;attr1=value1?query"' 
     442        URIstr = 'scheme://user:passwd@authority:4242/path;attr1=value1?query' 
     443        uri = URIparser.URIAuthorityDefault(URIstr) 
     444        self.failUnlessEqual(uri.uri, URIstr) 
     445        self.verifyURIParts(uri, 'scheme', 'user:passwd@authority:4242', '/path;attr1=value1', 'query', None) 
     446 
     447    def testSchemeUserPasswdAuthorityHostPathAttributesQuery(self): 
     448        'Authority Default: "scheme:user:passwd@authority:4242/path;attr1=value1?query"' 
     449        URIstr = 'scheme:user:passwd@authority:4242/path;attr1=value1?query' 
     450        uri = URIparser.URIAuthorityDefault(URIstr) 
     451        self.failUnlessEqual(uri.uri, URIstr) 
     452        self.verifyURIParts(uri, 'scheme', 'user:passwd@authority:4242', '/path;attr1=value1', 'query', None) 
     453 
     454    def testSchemeNetworkUserPasswdAuthorityHostPathAttributesQueryFragment(self): 
     455        'Authority Default: "scheme://user:passwd@authority:4242/path;attr1=value1?query#fragment"' 
     456        URIstr = 'scheme://user:passwd@authority:4242/path;attr1=value1?query#fragment' 
     457        uri = URIparser.URIAuthorityDefault(URIstr) 
     458        self.failUnlessEqual(uri.uri, URIstr) 
     459        self.verifyURIParts(uri, 'scheme', 'user:passwd@authority:4242', '/path;attr1=value1', 'query', 'fragment') 
     460 
     461    def testSchemeUserPasswdAuthorityHostPathAttributesQueryFragment(self): 
     462        'Authority Default: "scheme:user:passwd@authority:4242/path;attr1=value1?query#fragment"' 
     463        URIstr = 'scheme:user:passwd@authority:4242/path;attr1=value1?query#fragment' 
     464        uri = URIparser.URIAuthorityDefault(URIstr) 
     465        self.failUnlessEqual(uri.uri, URIstr) 
     466        self.verifyURIParts(uri, 'scheme', 'user:passwd@authority:4242', '/path;attr1=value1', 'query', 'fragment') 
     467 
     468    def testSchemeNetworkNullAuthorityPathAttributesQueryFragment(self): 
     469        'Authority Default: "scheme:///path;attr1=value1?query#fragment"' 
     470        URIstr = 'scheme:///path;attr1=value1?query#fragment' 
     471        uri = URIparser.URIAuthorityDefault(URIstr) 
     472        self.failUnlessEqual(uri.uri, URIstr) 
     473        self.verifyURIParts(uri, 'scheme', '', '/path;attr1=value1', 'query', 'fragment') 
     474 
     475    def testSchemePathAttributesQueryFragment(self): 
     476        'Authority Default: "scheme:/path;attr1=value1?query#fragment"' 
     477        URIstr = 'scheme:/path;attr1=value1?query#fragment' 
     478        uri = URIparser.URIAuthorityDefault(URIstr) 
     479        self.failUnlessEqual(uri.uri, URIstr) 
     480        self.verifyURIParts(uri, 'scheme', '', '/path;attr1=value1', 'query', 'fragment') 
     481 
     482    def testNetworkNullAuthorityPathAttributesQueryFragment(self): 
     483        'Authority Default: "///path;attr1=value1?query#fragment"' 
     484        URIstr = '///path;attr1=value1?query#fragment' 
     485        uri = URIparser.URIAuthorityDefault(URIstr) 
     486        self.failUnlessEqual(uri.uri, URIstr) 
     487        self.verifyURIParts(uri, None, '', '/path;attr1=value1', 'query', 'fragment') 
     488 
     489    def testPathAttributesQueryFragment(self): 
     490        'Authority Default: "/path;attr1=value1?query#fragment"' 
     491        URIstr = '/path;attr1=value1?query#fragment' 
     492        uri = URIparser.URIAuthorityDefault(URIstr) 
     493        self.failUnlessEqual(uri.uri, URIstr) 
     494        self.verifyURIParts(uri, None, '', '/path;attr1=value1', 'query', 'fragment') 
     495 
     496    def testPathQueryFragment(self): 
     497        'Authority Default: "/path?query#fragment"' 
     498        URIstr = '/path?query#fragment' 
     499        uri = URIparser.URIAuthorityDefault(URIstr) 
     500        self.failUnlessEqual(uri.uri, URIstr) 
     501        self.verifyURIParts(uri, None, '', '/path', 'query', 'fragment') 
     502 
     503    def testQueryFragment(self): 
     504        'Authority Default: "?query#fragment"' 
     505        URIstr = '?query#fragment' 
     506        uri = URIparser.URIAuthorityDefault(URIstr) 
     507        self.failUnlessEqual(uri.uri, URIstr) 
     508        self.verifyURIParts(uri, None, '', None, 'query', 'fragment') 
     509 
     510    def testSchemeQuery(self): 
     511        'Authority Default: "scheme:?query"' 
     512        URIstr = 'scheme:?query' 
     513        uri = URIparser.URIAuthorityDefault(URIstr) 
     514        self.failUnlessEqual(uri.uri, URIstr) 
     515        self.verifyURIParts(uri, 'scheme', '', None, 'query', None) 
     516 
     517    def testQuery(self): 
     518        'Authority Default: "?query"' 
     519        URIstr = '?query' 
     520        uri = URIparser.URIAuthorityDefault(URIstr) 
     521        self.failUnlessEqual(uri.uri, URIstr) 
     522        self.verifyURIParts(uri, None, '', None, 'query', None) 
     523 
     524    def testFragment(self): 
     525        'Authority Default: "#fragment"' 
     526        URIstr = '#fragment' 
     527        uri = URIparser.URIAuthorityDefault(URIstr) 
     528        self.failUnlessEqual(uri.uri, URIstr) 
     529        self.verifyURIParts(uri, None, '', None, None, 'fragment') 
     530 
     531    def testSchemeFragment(self): 
     532        'Authority Default: "scheme:#fragment"' 
     533        URIstr = 'scheme:#fragment' 
     534        uri = URIparser.URIAuthorityDefault(URIstr) 
     535        self.failUnlessEqual(uri.uri, URIstr) 
     536        self.verifyURIParts(uri, 'scheme', '', None, None, 'fragment') 
     537 
     538    def testPathQuery(self): 
     539        'Authority Default: "/path?query"' 
     540        URIstr = '/path?query' 
     541        uri = URIparser.URIAuthorityDefault(URIstr) 
     542        self.failUnlessEqual(uri.uri, URIstr) 
     543        self.verifyURIParts(uri, None, '', '/path', 'query', None) 
     544 
     545    def testPathFragment(self): 
     546        'Authority Default: "/path#fragment"' 
     547        URIstr = '/path#fragment' 
     548        uri = URIparser.URIAuthorityDefault(URIstr) 
     549        self.failUnlessEqual(uri.uri, URIstr) 
     550        self.verifyURIParts(uri, None, '', '/path', None, 'fragment') 
    69551 
    70552#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 
  • trunk/RBFoundation/test/test_doctests.py

    r306 r403  
    2424#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 
    2525 
    26 from Foundation import WeakBind, ContextApply, Utilities, LazyProperty, ChainedDict, AttributedDict, Acquisition, IndexedProperty 
     26from RBFoundation import WeakBind, ContextApply, Utilities, LazyProperty, ChainedDict, AttributedDict, Acquisition, IndexedProperty 
    2727 
    2828#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~