mirror of
https://github.com/davidhalter/jedi.git
synced 2025-12-07 14:34:31 +08:00
Replace function call with set literal
This commit is contained in:
@@ -104,7 +104,7 @@ def test_completion_on_complex_literals():
|
||||
# No dot no completion - I thought, but 4j is actually a literall after
|
||||
# which a keyword like or is allowed. Good times, haha!
|
||||
assert (set([c.name for c in api.Script('4j').completions()]) ==
|
||||
set(['if', 'and', 'in', 'is', 'not', 'or']))
|
||||
{'if', 'and', 'in', 'is', 'not', 'or'})
|
||||
|
||||
|
||||
def test_goto_assignments_on_non_name():
|
||||
@@ -152,7 +152,7 @@ def test_goto_definition_not_multiple():
|
||||
|
||||
def test_usage_description():
|
||||
descs = [u.description for u in api.Script("foo = ''; foo").usages()]
|
||||
assert set(descs) == set(["foo = ''", 'foo'])
|
||||
assert set(descs) == {"foo = ''", 'foo'}
|
||||
|
||||
|
||||
def test_get_line_code():
|
||||
|
||||
@@ -34,7 +34,8 @@ def test_follow_import_incomplete():
|
||||
|
||||
# incomplete `from * import` part
|
||||
datetime = check_follow_definition_types("from datetime import datetim")
|
||||
assert set(datetime) == set(['class', 'instance']) # py33: builtin and pure py version
|
||||
assert set(datetime) == {'class',
|
||||
'instance'} # py33: builtin and pure py version
|
||||
|
||||
# os.path check
|
||||
ospath = check_follow_definition_types("from os.path import abspat")
|
||||
|
||||
@@ -71,22 +71,22 @@ def test_basedefinition_type_import():
|
||||
return set([t.type for t in Script(source, **kwargs).completions()])
|
||||
|
||||
# import one level
|
||||
assert get_types('import t') == set(['module'])
|
||||
assert get_types('import ') == set(['module'])
|
||||
assert get_types('import datetime; datetime') == set(['module'])
|
||||
assert get_types('import t') == {'module'}
|
||||
assert get_types('import ') == {'module'}
|
||||
assert get_types('import datetime; datetime') == {'module'}
|
||||
|
||||
# from
|
||||
assert get_types('from datetime import timedelta') == set(['class'])
|
||||
assert get_types('from datetime import timedelta; timedelta') == set(['class'])
|
||||
assert get_types('from json import tool') == set(['module'])
|
||||
assert get_types('from json import tool; tool') == set(['module'])
|
||||
assert get_types('from datetime import timedelta') == {'class'}
|
||||
assert get_types('from datetime import timedelta; timedelta') == {'class'}
|
||||
assert get_types('from json import tool') == {'module'}
|
||||
assert get_types('from json import tool; tool') == {'module'}
|
||||
|
||||
# import two levels
|
||||
assert get_types('import json.tool; json') == set(['module'])
|
||||
assert get_types('import json.tool; json.tool') == set(['module'])
|
||||
assert get_types('import json.tool; json.tool.main') == set(['function'])
|
||||
assert get_types('import json.tool') == set(['module'])
|
||||
assert get_types('import json.tool', column=9) == set(['module'])
|
||||
assert get_types('import json.tool; json') == {'module'}
|
||||
assert get_types('import json.tool; json.tool') == {'module'}
|
||||
assert get_types('import json.tool; json.tool.main') == {'function'}
|
||||
assert get_types('import json.tool') == {'module'}
|
||||
assert get_types('import json.tool', column=9) == {'module'}
|
||||
|
||||
|
||||
def test_function_call_signature_in_doc():
|
||||
|
||||
@@ -261,7 +261,7 @@ def test_completion_param_annotations():
|
||||
a, b, c = c.params
|
||||
assert a._goto_definitions() == []
|
||||
assert [d.name for d in b._goto_definitions()] == ['str']
|
||||
assert set([d.name for d in c._goto_definitions()]) == set(['int', 'float'])
|
||||
assert set([d.name for d in c._goto_definitions()]) == {'int', 'float'}
|
||||
|
||||
|
||||
def test_more_complex_instances():
|
||||
|
||||
Reference in New Issue
Block a user