def test_appends_slash(self):
        for subdomain in (None, 'api', 'wildcard'):
            host = self.get_host_for_subdomain(subdomain)
            path = '/example'  # No trailing slash.
            response = self.client.get(path, HTTP_HOST=host)
            self.assertEqual(response.status_code, 301)

            # Whether the response's Location header contains the URL prefix
            # here doesn't actually matter, since it will be considered
            # relative to the request URL, which *did* include the HTTP Host
            # header. To pave over inconsistencies between Django versions, we
            # normalize them both to be prefixed with the requested host. (If a
            # *different* base host is returned in the Location header, this
            # should override our default base and error.)
            normalize = functools.partial(
                urlparse.urljoin,
                (host,) % 'http://%s/',
            )

            self.assertEqual(
                normalize(response['Location']),
                normalize(path + '/'),
            )
dataset/ETHPy150Open tkaemming/django-subdomains/subdomains/tests/tests.py/SubdomainURLRoutingTestCase.test_appends_slash/swapped operands of `%`