mirror of
https://github.com/kevin1024/vcrpy.git
synced 2025-12-08 16:53:23 +00:00
Rewrite unnecessary list/tuple literals as set literals
This commit is contained in:
@@ -22,7 +22,7 @@ def assert_matcher(matcher_name):
|
||||
matcher = getattr(matchers, matcher_name)
|
||||
for k1, k2 in itertools.permutations(REQUESTS, 2):
|
||||
matched = matcher(REQUESTS[k1], REQUESTS[k2])
|
||||
if matcher_name in set((k1, k2)):
|
||||
if matcher_name in {k1, k2}:
|
||||
assert not matched
|
||||
else:
|
||||
assert matched
|
||||
@@ -31,7 +31,7 @@ def assert_matcher(matcher_name):
|
||||
def test_uri_matcher():
|
||||
for k1, k2 in itertools.permutations(REQUESTS, 2):
|
||||
matched = matchers.uri(REQUESTS[k1], REQUESTS[k2])
|
||||
if set((k1, k2)) != set(('base', 'method')):
|
||||
if {k1, k2} != {'base', 'method'}:
|
||||
assert not matched
|
||||
else:
|
||||
assert matched
|
||||
|
||||
@@ -319,11 +319,11 @@ def test_additional_matchers():
|
||||
|
||||
@vcr.use_cassette
|
||||
def function_defaults(cassette):
|
||||
assert set(cassette._match_on) == set([vcr.matchers['uri']])
|
||||
assert set(cassette._match_on) == {vcr.matchers['uri']}
|
||||
|
||||
@vcr.use_cassette(additional_matchers=('body',))
|
||||
def function_additional(cassette):
|
||||
assert set(cassette._match_on) == set([vcr.matchers['uri'], vcr.matchers['body']])
|
||||
assert set(cassette._match_on) == {vcr.matchers['uri'], vcr.matchers['body']}
|
||||
|
||||
function_defaults()
|
||||
function_additional()
|
||||
|
||||
@@ -13,9 +13,7 @@ class VCRHTTPConnectionWithTimeout(VCRHTTPConnection,
|
||||
HTTPConnection.__init__.'''
|
||||
|
||||
# Delete the keyword arguments that HTTPConnection would not recognize
|
||||
safe_keys = set(
|
||||
('host', 'port', 'strict', 'timeout', 'source_address')
|
||||
)
|
||||
safe_keys = {'host', 'port', 'strict', 'timeout', 'source_address'}
|
||||
unknown_keys = set(kwargs.keys()) - safe_keys
|
||||
safe_kwargs = kwargs.copy()
|
||||
for kw in unknown_keys:
|
||||
@@ -33,7 +31,7 @@ class VCRHTTPSConnectionWithTimeout(VCRHTTPSConnection,
|
||||
def __init__(self, *args, **kwargs):
|
||||
|
||||
# Delete the keyword arguments that HTTPSConnection would not recognize
|
||||
safe_keys = set((
|
||||
safe_keys = {
|
||||
'host',
|
||||
'port',
|
||||
'key_file',
|
||||
@@ -42,7 +40,7 @@ class VCRHTTPSConnectionWithTimeout(VCRHTTPSConnection,
|
||||
'timeout',
|
||||
'source_address',
|
||||
'ca_certs',
|
||||
))
|
||||
}
|
||||
unknown_keys = set(kwargs.keys()) - safe_keys
|
||||
safe_kwargs = kwargs.copy()
|
||||
for kw in unknown_keys:
|
||||
|
||||
Reference in New Issue
Block a user