1
0
forked from VimPlug/jedi

Make __file__ return the correct value

This commit is contained in:
Dave Halter
2019-08-05 17:48:30 +02:00
parent b7c2bacbd2
commit 4b8505b78d
3 changed files with 26 additions and 5 deletions

View File

@@ -5,3 +5,14 @@ def test_module_attributes(Script):
assert def_.column is None
str_, = def_.infer()
assert str_.name == 'str'
def test_module__file__(Script, environment):
assert not Script('__file__').goto_definitions()
def_, = Script('__file__', path='example.py').goto_definitions()
value = def_._name._context.get_safe_value()
assert value.endswith('example.py')
def_, = Script('import antigravity; antigravity.__file__').goto_definitions()
value = def_._name._context.get_safe_value()
assert value.endswith('.py')