diff --git a/tests/integration/test_ignore.py b/tests/integration/test_ignore.py index 164edb8..9cfb586 100644 --- a/tests/integration/test_ignore.py +++ b/tests/integration/test_ignore.py @@ -26,9 +26,9 @@ def test_ignore_localhost(tmpdir, httpbin): with overridden_dns({'httpbin.org': '127.0.0.1'}): cass_file = str(tmpdir.join('filter_qs.yaml')) with vcr.use_cassette(cass_file, ignore_localhost=True) as cass: - urlopen('http://localhost:{0}/'.format(httpbin.port)) + urlopen('http://localhost:{}/'.format(httpbin.port)) assert len(cass) == 0 - urlopen('http://httpbin.org:{0}/'.format(httpbin.port)) + urlopen('http://httpbin.org:{}/'.format(httpbin.port)) assert len(cass) == 1 @@ -39,9 +39,9 @@ def test_ignore_httpbin(tmpdir, httpbin): cass_file, ignore_hosts=['httpbin.org'] ) as cass: - urlopen('http://httpbin.org:{0}/'.format(httpbin.port)) + urlopen('http://httpbin.org:{}/'.format(httpbin.port)) assert len(cass) == 0 - urlopen('http://localhost:{0}/'.format(httpbin.port)) + urlopen('http://localhost:{}/'.format(httpbin.port)) assert len(cass) == 1 @@ -53,8 +53,8 @@ def test_ignore_localhost_and_httpbin(tmpdir, httpbin): ignore_hosts=['httpbin.org'], ignore_localhost=True ) as cass: - urlopen('http://httpbin.org:{0}'.format(httpbin.port)) - urlopen('http://localhost:{0}'.format(httpbin.port)) + urlopen('http://httpbin.org:{}'.format(httpbin.port)) + urlopen('http://localhost:{}'.format(httpbin.port)) assert len(cass) == 0 @@ -62,12 +62,12 @@ def test_ignore_localhost_twice(tmpdir, httpbin): with overridden_dns({'httpbin.org': '127.0.0.1'}): cass_file = str(tmpdir.join('filter_qs.yaml')) with vcr.use_cassette(cass_file, ignore_localhost=True) as cass: - urlopen('http://localhost:{0}'.format(httpbin.port)) + urlopen('http://localhost:{}'.format(httpbin.port)) assert len(cass) == 0 - urlopen('http://httpbin.org:{0}'.format(httpbin.port)) + urlopen('http://httpbin.org:{}'.format(httpbin.port)) assert len(cass) == 1 with vcr.use_cassette(cass_file, ignore_localhost=True) as cass: assert len(cass) == 1 - urlopen('http://localhost:{0}'.format(httpbin.port)) - urlopen('http://httpbin.org:{0}'.format(httpbin.port)) + urlopen('http://localhost:{}'.format(httpbin.port)) + urlopen('http://httpbin.org:{}'.format(httpbin.port)) assert len(cass) == 1 diff --git a/tests/integration/test_urllib3.py b/tests/integration/test_urllib3.py index 51618c7..d187f7b 100644 --- a/tests/integration/test_urllib3.py +++ b/tests/integration/test_urllib3.py @@ -56,7 +56,7 @@ def test_body(tmpdir, httpbin_both, verify_pool_mgr): def test_auth(tmpdir, httpbin_both, verify_pool_mgr): '''Ensure that we can handle basic auth''' auth = ('user', 'passwd') - headers = urllib3.util.make_headers(basic_auth='{0}:{1}'.format(*auth)) + headers = urllib3.util.make_headers(basic_auth='{}:{}'.format(*auth)) url = httpbin_both.url + '/basic-auth/user/passwd' with vcr.use_cassette(str(tmpdir.join('auth.yaml'))): one = verify_pool_mgr.request('GET', url, headers=headers) @@ -70,7 +70,7 @@ def test_auth(tmpdir, httpbin_both, verify_pool_mgr): def test_auth_failed(tmpdir, httpbin_both, verify_pool_mgr): '''Ensure that we can save failed auth statuses''' auth = ('user', 'wrongwrongwrong') - headers = urllib3.util.make_headers(basic_auth='{0}:{1}'.format(*auth)) + headers = urllib3.util.make_headers(basic_auth='{}:{}'.format(*auth)) url = httpbin_both.url + '/basic-auth/user/passwd' with vcr.use_cassette(str(tmpdir.join('auth-failed.yaml'))) as cass: # Ensure that this is empty to begin with diff --git a/vcr/cassette.py b/vcr/cassette.py index c6e3b81..4c95877 100644 --- a/vcr/cassette.py +++ b/vcr/cassette.py @@ -304,7 +304,7 @@ class Cassette(object): pass def __str__(self): - return "".format( + return "".format( len(self) ) diff --git a/vcr/config.py b/vcr/config.py index 91e031a..48fb7fe 100644 --- a/vcr/config.py +++ b/vcr/config.py @@ -78,7 +78,7 @@ class VCR(object): serializer = self.serializers[serializer_name] except KeyError: raise KeyError( - "Serializer {0} doesn't exist or isn't registered".format( + "Serializer {} doesn't exist or isn't registered".format( serializer_name ) ) @@ -91,7 +91,7 @@ class VCR(object): matchers.append(self.matchers[m]) except KeyError: raise KeyError( - "Matcher {0} doesn't exist or isn't registered".format(m) + "Matcher {} doesn't exist or isn't registered".format(m) ) return matchers diff --git a/vcr/matchers.py b/vcr/matchers.py index 8fe334e..f2029a8 100644 --- a/vcr/matchers.py +++ b/vcr/matchers.py @@ -90,8 +90,8 @@ def _log_matches(r1, r2, matches): differences = [m for m in matches if not m[0]] if differences: log.debug( - "Requests {0} and {1} differ according to " - "the following matchers: {2}".format(r1, r2, differences) + "Requests {} and {} differ according to " + "the following matchers: {}".format(r1, r2, differences) ) diff --git a/vcr/migration.py b/vcr/migration.py index 23b5e5e..ba5ae2c 100644 --- a/vcr/migration.py +++ b/vcr/migration.py @@ -59,7 +59,7 @@ def build_uri(**parts): port = parts['port'] scheme = parts['protocol'] default_port = {'https': 443, 'http': 80}[scheme] - parts['port'] = ':{0}'.format(port) if port != default_port else '' + parts['port'] = ':{}'.format(port) if port != default_port else '' return "{protocol}://{host}{port}{path}".format(**parts) @@ -161,7 +161,7 @@ def main(): for file_path in files: migrated = try_migrate(file_path) status = 'OK' if migrated else 'FAIL' - sys.stderr.write("[{0}] {1}\n".format(status, file_path)) + sys.stderr.write("[{}] {}\n".format(status, file_path)) sys.stderr.write("Done.\n") diff --git a/vcr/patch.py b/vcr/patch.py index 9de12a3..ac8ef29 100644 --- a/vcr/patch.py +++ b/vcr/patch.py @@ -169,7 +169,7 @@ class CassettePatcherBuilder(object): bases = (base_class,) if not issubclass(base_class, object): # Check for old style class bases += (object,) - return type('{0}{1}'.format(base_class.__name__, self._cassette._path), + return type('{}{}'.format(base_class.__name__, self._cassette._path), bases, dict(cassette=self._cassette)) @_build_patchers_from_mock_triples_decorator diff --git a/vcr/request.py b/vcr/request.py index 63e451e..882db69 100644 --- a/vcr/request.py +++ b/vcr/request.py @@ -81,7 +81,7 @@ class Request(object): return self.scheme def __str__(self): - return "".format(self.method, self.uri) + return "".format(self.method, self.uri) def __repr__(self): return self.__str__() diff --git a/vcr/stubs/__init__.py b/vcr/stubs/__init__.py index 67cb5e7..5ab819d 100644 --- a/vcr/stubs/__init__.py +++ b/vcr/stubs/__init__.py @@ -132,11 +132,11 @@ class VCRConnection(object): """ port = self.real_connection.port default_port = {'https': 443, 'http': 80}[self._protocol] - return ':{0}'.format(port) if port != default_port else '' + return ':{}'.format(port) if port != default_port else '' def _uri(self, url): """Returns request absolute URI""" - uri = "{0}://{1}{2}{3}".format( + uri = "{}://{}{}{}".format( self._protocol, self.real_connection.host, self._port_postfix(), @@ -146,7 +146,7 @@ class VCRConnection(object): def _url(self, uri): """Returns request selector url from absolute URI""" - prefix = "{0}://{1}{2}".format( + prefix = "{}://{}{}".format( self._protocol, self.real_connection.host, self._port_postfix(), @@ -161,7 +161,7 @@ class VCRConnection(object): body=body, headers=headers or {} ) - log.debug('Got {0}'.format(self._vcr_request)) + log.debug('Got {}'.format(self._vcr_request)) # Note: The request may not actually be finished at this point, so # I'm not sending the actual request until getresponse(). This @@ -180,7 +180,7 @@ class VCRConnection(object): body="", headers={} ) - log.debug('Got {0}'.format(self._vcr_request)) + log.debug('Got {}'.format(self._vcr_request)) def putheader(self, header, *values): self._vcr_request.headers[header] = values @@ -214,7 +214,7 @@ class VCRConnection(object): # then return it if self.cassette.can_play_response_for(self._vcr_request): log.info( - "Playing response for {0} from cassette".format( + "Playing response for {} from cassette".format( self._vcr_request ) ) @@ -236,7 +236,7 @@ class VCRConnection(object): # and return it. log.info( - "{0} not in cassette, sending to real server".format( + "{} not in cassette, sending to real server".format( self._vcr_request ) )