mirror of
https://github.com/davidhalter/jedi.git
synced 2025-12-07 06:24:27 +08:00
Tests and implementation for type on lambda and function objects.
This commit is contained in:
@@ -559,6 +559,9 @@ class Function(use_metaclass(CachedMetaClass, Wrapper)):
|
|||||||
else:
|
else:
|
||||||
return FunctionExecution(evaluator, self, params).get_return_types()
|
return FunctionExecution(evaluator, self, params).get_return_types()
|
||||||
|
|
||||||
|
def py__class__(self, evaluator):
|
||||||
|
return compiled.magic_function_class
|
||||||
|
|
||||||
def __getattr__(self, name):
|
def __getattr__(self, name):
|
||||||
return getattr(self.base_func, name)
|
return getattr(self.base_func, name)
|
||||||
|
|
||||||
|
|||||||
@@ -35,8 +35,9 @@ next(open(''))
|
|||||||
#? ['__itemsize__']
|
#? ['__itemsize__']
|
||||||
tuple.__itemsize__
|
tuple.__itemsize__
|
||||||
|
|
||||||
# type
|
# -----------------
|
||||||
|
# type() calls with one parameter
|
||||||
|
# -----------------
|
||||||
#? int
|
#? int
|
||||||
type(1)
|
type(1)
|
||||||
#? int
|
#? int
|
||||||
@@ -53,6 +54,8 @@ def x():
|
|||||||
generator = type(x())
|
generator = type(x())
|
||||||
#? generator
|
#? generator
|
||||||
type(x for x in [])
|
type(x for x in [])
|
||||||
|
#? type(x)
|
||||||
|
type(lambda: x)
|
||||||
|
|
||||||
# -----------------
|
# -----------------
|
||||||
# re
|
# re
|
||||||
|
|||||||
@@ -1,3 +1,7 @@
|
|||||||
|
# -----------------
|
||||||
|
# Simple tests
|
||||||
|
# -----------------
|
||||||
|
|
||||||
import random
|
import random
|
||||||
|
|
||||||
if random.choice([0, 1]):
|
if random.choice([0, 1]):
|
||||||
|
|||||||
Reference in New Issue
Block a user