def assertRoute(self, url, expected_return, params={}, router=None, method='GET'):
    if router is None:
      r = self.router
    else:
      r = router
    url = URL(url)
    if echo:
      print '\nRouting \'%s\' expected to return %r (params=%s)' % (url, expected_return, params)
    dest, args, params = r(method, url, [], params)
    if isinstance(expected_return, http.Status):
      try:
        dest_returned = dest()
        assert r == 0, 'should raise %r but did not raise any exception '\
          'at all. dest() returned %r' % (expected_return, dest_returned)
      except http.HTTPExc, e:
        self.assertEquals(e.status.__class__, expected_return.__class__, '%r (%x) != %r (%x)' %\
          (expected_return, id(expected_return), e.status, id(e.status)))
      except AssertionError:
        raise
      except Exception, e:
        assert 0, 'should have raised %r, but instead %r was raised' %\
          (expected_return, e)
    else:
      if dest is not None:
        if echo:
          print 'Calling %r(*%s, **%s)' % (dest, args, params)
        returned = dest(*args, **params)
      else:
        returned = Nothing
      assert returned == expected_return, '%s != %s' % (returned, expected_return)
dataset/ETHPy150Open rsms/smisk/lib/smisk/test/mvc/routing.py/RoutingTests.assertRoute/original