mirror of
https://github.com/davidhalter/jedi.git
synced 2026-01-20 02:42:49 +08:00
static analysis start positions are now tested
This commit is contained in:
@@ -5,7 +5,7 @@ class Cls():
|
||||
self.input = input
|
||||
|
||||
def f(self):
|
||||
#! attribute-error
|
||||
#! 12 attribute-error
|
||||
return self.not_existing
|
||||
|
||||
def undefined_object(self, obj):
|
||||
@@ -20,10 +20,10 @@ class Cls():
|
||||
`obj` is defined by a call into this function.
|
||||
"""
|
||||
obj.upper
|
||||
#! attribute-error
|
||||
#! 4 attribute-error
|
||||
obj.arbitrary_lookup
|
||||
|
||||
#! name-error
|
||||
#! 13 name-error
|
||||
class_attr = a
|
||||
|
||||
Cls().defined_lookup('')
|
||||
@@ -31,16 +31,16 @@ Cls().defined_lookup('')
|
||||
c = Cls()
|
||||
c.class_attr
|
||||
Cls.class_attr
|
||||
#! attribute-error
|
||||
#! 4 attribute-error
|
||||
Cls.class_attr_error
|
||||
c.instance_attr
|
||||
#! attribute-error
|
||||
#! 2 attribute-error
|
||||
c.instance_attr_error
|
||||
|
||||
|
||||
c.something = None
|
||||
|
||||
#! name-error
|
||||
#! 12 name-error
|
||||
something = a
|
||||
something
|
||||
|
||||
@@ -50,28 +50,28 @@ something
|
||||
|
||||
# should not raise anything.
|
||||
for loop_variable in [1, 2]:
|
||||
#! name-error
|
||||
#! 4 name-error
|
||||
x = undefined
|
||||
loop_variable
|
||||
|
||||
#! name-error
|
||||
#! 28 name-error
|
||||
for loop_variable in [1, 2, undefined]:
|
||||
pass
|
||||
|
||||
#! attribute-error
|
||||
#! 7 attribute-error
|
||||
[1, ''.undefined_attr]
|
||||
|
||||
|
||||
def return_one(something):
|
||||
return 1
|
||||
|
||||
#! attribute-error
|
||||
#! 14 attribute-error
|
||||
return_one(''.undefined_attribute)
|
||||
|
||||
#! name-error
|
||||
#! 12 name-error
|
||||
[r for r in undefined]
|
||||
|
||||
#! name-error
|
||||
#! 1 name-error
|
||||
[undefined for r in [1, 2]]
|
||||
|
||||
[r for r in [1, 2]]
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
def generator():
|
||||
yield 1
|
||||
|
||||
#! type-error-generator
|
||||
#! 11 type-error-generator
|
||||
generator()[0]
|
||||
|
||||
list(generator())[0]
|
||||
|
||||
@@ -11,7 +11,7 @@ from os.path import not_existing
|
||||
from datetime import date
|
||||
date.today
|
||||
|
||||
#! attribute-error
|
||||
#! 5 attribute-error
|
||||
date.not_existing_attribute
|
||||
|
||||
#! import-error
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
try:
|
||||
#! attribute-error
|
||||
#! 4 attribute-error
|
||||
str.not_existing
|
||||
except TypeError:
|
||||
pass
|
||||
@@ -7,7 +7,7 @@ except TypeError:
|
||||
try:
|
||||
str.not_existing
|
||||
except AttributeError:
|
||||
#! attribute-error
|
||||
#! 4 attribute-error
|
||||
str.not_existing
|
||||
pass
|
||||
|
||||
@@ -35,7 +35,7 @@ except ImportError:
|
||||
except (NotImplementedError, AttributeError): pass
|
||||
|
||||
try:
|
||||
#! attribute-error
|
||||
#! 4 attribute-error
|
||||
str.not_existing
|
||||
except (TypeError, NotImplementedError): pass
|
||||
|
||||
@@ -46,6 +46,6 @@ try:
|
||||
str.not_existing
|
||||
except ((AttributeError)): pass
|
||||
try:
|
||||
#! attribute-error
|
||||
#! 4 attribute-error
|
||||
str.not_existing
|
||||
except [AttributeError]: pass
|
||||
|
||||
Reference in New Issue
Block a user