summaryrefslogtreecommitdiff
path: root/astroid/tests
Commit message (Collapse)AuthorAgeFilesLines
* print_statement -> print_function.fix-python3-testsOmer Katz2015-06-023-3/+3
|
* Fixed syntax errors in Python 3.Omer Katz2015-06-017-15/+16
|
* Add a new SuperError exception subclass, SuperArgumentTypeError, which is ↵Claudiu Popa2015-05-291-2/+4
| | | | raised when there's a problem with any argument of the super call (invalid types).
* Fail when calling Super.super_mro if the object-or-type is not the expected ↵Claudiu Popa2015-05-291-0/+11
| | | | type.
* Update the rules for what descriptor is returned from a super(), depending ↵Claudiu Popa2015-05-281-6/+59
| | | | on the accessed object.
* Add a new *inference object* called SuperClaudiu Popa2015-05-281-0/+380
| | | | | | | | | | | | This patch also adds support for understanding super calls. astroid understands the zero-argument form of super, specific to Python 3, where the interpreter fills itself the arguments of the call. Also, we are understanding the 2-argument form of super, both for bounded lookups (super(X, instance)) as well as for unbounded lookups (super(X, Y)), having as well support for validating that the object-or-type is a subtype of the first argument. The unbounded form of super (one argument) is not understood, since it's useless in practice and should be removed from Python's specification. Closes issue #89.
* Fix pylint warnings over astroid, update the list of disabled messages in ↵Claudiu Popa2015-05-198-213/+206
| | | | pylintrc.
* Activate a disabled test.Claudiu Popa2015-05-191-10/+11
|
* Fix bad-continuation errors from astroid.Claudiu Popa2015-05-194-31/+26
|
* Add a new type of nodes, called *inference objects*.Claudiu Popa2015-05-193-0/+101
| | | | | | | | | | | Inference objects are similar with AST nodes, but they can be obtained only after inference, so they can't be found inside the AST tree. Their purpose is to handle at astroid level some operations which can't be handled when using brain transforms. For instance, the first object added is FrozenSet, which can be manipulated at astroid's level (inferred, itered etc). Code such as this 'frozenset((1,2))' will not return an Instance of frozenset, without having access to its content, but a new objects.FrozenSet, which can be used just as a nodes.Set.
* Merge.Claudiu Popa2015-05-131-0/+17
|\
| * Add brain module for dateutil.parser.parsepylint-480raylu2015-05-121-0/+18
| |
* | Cleanup.Claudiu Popa2015-05-111-2/+5
|/
* Raise an InferenceError when having multiple 'as' bindings from a context ↵Claudiu Popa2015-05-091-0/+15
| | | | manager, but the result doesn't have those indices.
* Remove trailing whitespace.Claudiu Popa2015-05-091-2/+2
|
* Add support for understanding context managers created with ↵Claudiu Popa2015-05-091-6/+67
| | | | contextlib.contextmanager.
* Add a test which shows that using namedtuple-generated classes with classes ↵Claudiu Popa2015-05-091-0/+11
| | | | with the same name leads to an invalid MRO.
* local_attr_ancestors fallbacks to using .ancestors if .mro() fails.Claudiu Popa2015-05-091-1/+8
|
* Remove trailing whitespace.Claudiu Popa2015-05-091-1/+1
|
* Add basic support for understanding context managers.Claudiu Popa2015-05-091-0/+88
| | | | | | | Currently, there's no way to understand whatever __enter__ returns in a context manager and what it is binded using the ``as`` keyword. With these changes, we can understand ``bar`` in ``with foo() as bar``, which will be the result of __enter__. There's no support for contextlib.contextmanager yet.
* Remove unused variable.Claudiu Popa2015-05-081-1/+1
|
* Handle builtins without a __module__, especially for Jython.Claudiu Popa2015-05-081-5/+11
|
* Remove trailing whitespace.Claudiu Popa2015-05-081-1/+1
|
* open doesn't have a __module__ attribute on Jython. Handle this case.Claudiu Popa2015-05-081-1/+15
|
* Make sure that sys.stderr is reset after the .infer() call.Claudiu Popa2015-05-071-7/+13
|
* Class.has_dynamic_getattr doesn't return True for special methods which ↵Claudiu Popa2015-05-071-0/+24
| | | | | | | | | | aren't implemented in pure Python. Since most likely the methods were coming from a live object, this implies that all of them will have __getattr__ and __getattribute__ present and it is wrong to consider that those methods were actually implemented (the descriptors will be there, not necessarily implying that the function is user implemented).
* _io names itself io. This patch fixes some cyclic dependencies when solving ↵Claudiu Popa2015-05-061-0/+17
| | | | io.BufferedReader and friends.
* Classes aren't marked as interfaces anymore, in the `type` attribute.Claudiu Popa2015-05-051-2/+0
|
* Fix recursive class attribute lookupsfix-recursive-attr-lookupsPhilip Lorenz2015-05-041-2/+20
| | | | | | | Commit 83053ac added MRO lookup support for new-style only class hierarchies. Due to a typo old-style / mixed-style class hierarchies were either not traversed recursively or traversed with the wrong context.
* Add two new exceptions for handling MRO error cases.Claudiu Popa2015-05-031-4/+15
| | | | | | | DuplicateBasesError is emitted when duplicate bases are found in a class, InconsistentMroError is raised when the method resolution is determined to be inconsistent. They share a common class, MroError, which is a subclass of ResolveError, meaning that this change is backwards compatible.
* Ensure that generated enum values have the correct base classesenum-fixesPhilip Lorenz2015-05-011-0/+33
| | | | | | | | | | | | | | Enum values should share the same base classes as their defining class. If this is not the case it may lead to wrong inference results when an enum member is used - e.g. for the following snippet: class X(enum.IntEnum): one = 1 print([1, 2][X.one]) pylint will detect a "invalid-sequence-index" error as the __index__ method of X.one is not detected.
* Add basic unit test for enum supportPhilip Lorenz2015-05-011-0/+34
| | | | | This test verifies that the generated enum member stubs behave implement the correct interface.
* Don't let ResolveError leak out from local_attr, when using .mro().Claudiu Popa2015-04-301-0/+7
|
* Expose a implicit_metaclass() method in Class.Claudiu Popa2015-04-251-0/+15
| | | | | This will return a builtins.type instance for newstyle classes, otherwise it will return None.
* Class.local_attr and Class.local_attr_ancestors uses internally a mro ↵Claudiu Popa2015-04-181-0/+22
| | | | | | | | | | | | | lookup, using .mro() method, if they can. That means for newstyle classes, when trying to lookup a member using one of these functions, the first one according to the mro will be returned. This reflects nicely the reality, but it can have as a drawback the fact that it is a behaviour change (the previous behaviour was incorrect though). Also, having bases which can return multiple values when inferred will not work with the new approach, because .mro() only retrieves the first value inferred from a base.
* Don't hard fail when calling .mro() on a class which has combined both ↵Claudiu Popa2015-04-181-0/+17
| | | | | | | newstyle and old style classes. The class in question is actually newstyle (and the __mro__ can be retrieved using Python). .mro() fallbacks to using .ancestors() in that case.
* Fix a typo in the possible properties list and add more tests.Claudiu Popa2015-04-181-1/+12
|
* Make is_property a private function. Remove some trailing whitespaces.Claudiu Popa2015-04-171-2/+2
|
* Support multiple types of known properties in _wrap_attr.Claudiu Popa2015-04-171-0/+41
|
* Remove trailing whitespace.Claudiu Popa2015-04-171-1/+1
|
* Merge.Claudiu Popa2015-04-171-0/+21
|\
| * UnboundMethod.getattr calls the getattr of its _proxied object.Claudiu Popa2015-04-171-0/+21
| | | | | | | | | | | | It previously crashed, since it called super(...).getattr(..) and the first ancestor in its mro was bases.Proxy and bases.Proxy doesn't implement the .getattr method. Closes issue #91.
* | Merged in mplatings/astroid (pull request #70)Claudiu Popa2015-04-1711-34/+307
|\ \ | |/ | | | | Work around the Python 2 part of issue https://bitbucket.org/logilab/astroid/issue/72/installing-astroid-via-setuptools-as-a
| * Improve the inference of Getattr nodes when dealing with abstract properties ↵Claudiu Popa2015-04-171-0/+16
| | | | | | | | | | | | | | | | | | | | from the abc module. In astroid.bases.Instance._wrap_attr we had a detection code for properties, which basically inferred whatever a property returned, passing the results up the stack, to the igetattr() method. It handled only the builtin property but the new patch also handles abc.abstractproperty.
| * .slots() will return an empty list for classes with empty slots.Claudiu Popa2015-04-141-0/+8
| | | | | | | | | | | | Previously it returned None, which is the same value for classes without slots at all. This was changed in order to better reflect what's actually happening.
| * Understand partially the 3-argument form of `type`.Claudiu Popa2015-04-131-0/+15
| | | | | | | | | | | | | | The only change is that astroid understands members passed in as dictionaries as the third argument. This improves the understanding of classes generated on-the-fly, using the type function.
| * Use a check on sys.version_info instead, to accomodate for Python 3.3Claudiu Popa2015-04-021-2/+2
| |
| * Add brain tips for multiprocessing post Python 3.4+.Claudiu Popa2015-04-021-4/+18
| | | | | | | | | | | | | | In Python 3.4+, the module level functions are retrieved with getattr from a context object, leading to many no-member errors in Pylint. This patch ensures us that we can retrieve those attributes, no matter what.
| * Remove trailing whitespaceClaudiu Popa2015-04-011-1/+1
| |
| * Set the current function as parent for the Generator object inferred from ↵Claudiu Popa2015-04-011-1/+16
| | | | | | | | `infer_call_result`.