def test_converter_with_tuples():
 class TwoValueConverter(r.BaseConverter, ):
  def __init__(self, *args, **kwargs):
   super(TwoValueConverter, self).__init__(*args, **kwargs)
   self.regex = '(\\w\\w+)/(\\w\\w+)'
  def to_python(self, two_values):
   (one, two) = two_values.split('/')
   return (one, two)
  def to_url(self, values):
   return ('%s/%s' % (values[0], values[1]))
 map = r.Map([r.Rule('/<two:foo>/', endpoint='handler')], converters={'two': TwoValueConverter})
 a = map.bind('example.org', '/')
 (route, kwargs) = a.match('/qwert/yuiop/')
 assert (kwargs['foo'] == ('qwert', 'yuiop'))

def test_converter_with_tuples ( ) : class TwoValueConverter ( r . BaseConverter , ) : def __init__ ( self , * args , ** kwargs ) : super ( TwoValueConverter , self ) . __init__ ( * args , ** kwargs ) self . regex = '(\\w\\w+)/(\\w\\w+)' def to_python ( self , two_values ) : ( one , two ) = two_values . split ( '/' ) return ( one , two ) def to_url ( self , values ) : return ( '%s/%s' % ( values [ 0 ] , values [ 1 ] ) ) map = r . Map ( [ r . Rule ( '/<two:foo>/' , endpoint = 'handler' ) ] , converters = { 'two' : TwoValueConverter } ) a = map . bind ( 'example.org' , '/' ) ( route , kwargs ) = a . match ( '/qwert/yuiop/' ) assert ( kwargs [ 'foo' ] == ( 'qwert' , 'yuiop' ) )
regression test for URL .