summaryrefslogtreecommitdiff
path: root/tests
Commit message (Collapse)AuthorAgeFilesLines
* Bump astroid to 2.6.3, update changelogv2.6.3Pierre Sassoulas2021-07-1926-6/+28
|
* Support lookup in nested non-FunctionDef scopes (#1102)David Liu2021-07-191-0/+114
| | | Co-authored-by: Pierre Sassoulas <pierre.sassoulas@gmail.com>
* Make TypedDict instance callableMarc Mueller2021-07-191-3/+12
|
* Add new If guard helper methods (#1099)Marc Mueller2021-07-131-0/+58
| | | | | * Add new if guard helper methods Co-authored-by: Pierre Sassoulas <pierre.sassoulas@gmail.com>
* Fix yield inference on inherited classes. (#1092)doranid2021-07-121-0/+21
| | | | * Add metadata to yield point. * Add ChangeLog.
* Don't infer MatchAs in assigned_stmts if pattern is not None (#1096)Marc Mueller2021-07-111-59/+66
| | | | * Move protocol match tests to separate class * Don't infer MatchAs in assigned_stmts if pattern is not None
* Fix issues when inferring match variables (#1093)Marc Mueller2021-07-101-1/+69
| | | | | | | * Fix issues when inferring match variables * Fix extract_node for MatchCase * Typing improvements * Fix pylint issues (no-name-in-module) * Use PY310_PLUS instead of sys.version_info
* Fix 'Consider using an in-place tuple instead of list'Pierre Sassoulas2021-07-102-6/+6
|
* Fix copyright links (#1084)Marc Mueller2021-07-0126-26/+26
| | | | * Fix link in license header * Fix link to cpython
* Bump astroid to 2.6.2, update changelogv2.6.2Pierre Sassoulas2021-06-301-1/+1
|
* Bump astroid to 2.6.1, update changelogv2.6.1Pierre Sassoulas2021-06-293-3/+3
|
* Create a constant for BUILTINS in astroid.constantsPierre Sassoulas2021-06-264-14/+4
|
* Add dict as base for TypedDict (#1074)Marc Mueller2021-06-251-0/+2
|
* Bump astroid to 2.6.0, update changelogv2.6.0Pierre Sassoulas2021-06-224-2/+4
|
* Rename non obvious PY3X constant to PY3X_PLUSPierre Sassoulas2021-06-215-21/+21
| | | | See https://github.com/PyCQA/astroid/pull/1069\#issuecomment-865206120
* Remove default init values Arguments + fix raw_building (#1065)Marc Mueller2021-06-211-0/+6
| | | | | | * Arguments - remove default init values * Fix raw_building.build_function * Use Arguments.postinit * Add kwonlyargs
* Small fixes following pep8 changesPierre Sassoulas2021-06-211-2/+2
| | | | | Re-add 'ex' in good name Fix a typo rrue = true
* Fix pep8 in unittest test function's namesPierre Sassoulas2021-06-205-31/+31
|
* Simplification because AstroidManager is a singleton/borgPierre Sassoulas2021-06-194-10/+11
|
* Use the Context enum directly and not a constant based on itPierre Sassoulas2021-06-191-9/+9
| | | | See https://github.com/PyCQA/astroid/pull/1045\#discussion_r654575507
* Rename astroid.constants to astroid.constPierre Sassoulas2021-06-195-5/+5
| | | | See https://github.com/PyCQA/astroid/pull/1045\#discussion_r654572722
* Create a permanent enum for Context instead of deleting the classPierre Sassoulas2021-06-191-9/+9
|
* Fix all no-member in the codebase and enable the warningPierre Sassoulas2021-06-181-1/+1
|
* Remove useless-suppression for no-member that disappearedPierre Sassoulas2021-06-182-6/+2
|
* Refactor builder tests to use a separate AstroidManager instanceAndrew Haigh2021-06-181-11/+11
|
* Refactor brain-less AstroidManager test fixtureAndrew Haigh2021-06-182-17/+5
|
* Fix global state pollution in unittest_managerAndrew Haigh2021-06-181-30/+39
| | | | | | | These tests left state in to the astroid manager that caused behavioural changes in various other tests run after them, such as test failures if unittest_brain ran after unittest_manager in the same test session. This change attempts to fix these inter-test dependencies.
* Remove PY36 constants, we always have PY36Pierre Sassoulas2021-06-171-1/+0
|
* Create a astroid.constants.py to avoid circular importsPierre Sassoulas2021-06-175-26/+18
| | | | And add PY3X type constants in it.
* Bump astroid to 2.6.0-dev0, update changelogPierre Sassoulas2021-06-161-1/+1
|
* Import exceptions from astroid.exceptions to avoid circular importsPierre Sassoulas2021-06-1512-93/+121
|
* Remove reference to travis or appveyor in the codebasePierre Sassoulas2021-06-151-2/+2
|
* Small fix + improvements to Match nodes (#1032)Marc Mueller2021-06-151-15/+43
| | | | | | | * Fix MatchClass fields * Add types to Match fields * Remove unnecessary Match get_children methods * Fix test variable name * Add tests for Match get_children
* Improve inference of Enum members called "name" and "value" (#1020)Andrew Haigh2021-06-131-1/+55
| | | | | | | | | | | | | | | | | | | | | | | | * Add DynamicClassAttribute to list of properties DynamicClassAttribute is a descriptor defined in Python's Lib/types.py which changes the behaviour of an attribute depending on if it is looked up on the class or on an instance. * Add fake "name" property to enum.Enum subclasses Ref PyCQA/pylint#1932. Ref PyCQA/pylint#2062. The enum.Enum class itself defines two @DynamicClassAttribute data-descriptors "name" and "value" which behave differently when looked up on an instance or on the class. When dealing with inference of an arbitrary instance of the enum class, e.g. in a method defined in the class body like: class SomeEnum(enum.Enum): def method(self): self.name # <- here we should assume that "self.name" is the string name of some enum member, unless the enum itself defines a "name" member. Co-authored-by: Pierre Sassoulas <pierre.sassoulas@gmail.com>
* Deprecate Ellipsis node (#1025)Marc Mueller2021-06-131-10/+4
|
* Prepare for 2.5.8 release (#1013)v2.5.8Pierre Sassoulas2021-06-078-8/+8
|
* Improve support for Pattern Matching (#1010)Marc Mueller2021-06-071-25/+61
| | | | | | | * Improve support for Pattern Matching * Fix lineno and col_offset * Add string representation for match nodes * Add NoChildrenMixin * Add example nodes in docstrings
* Update copyright notice for 2.5.7v2.5.7Pierre Sassoulas2021-05-299-4/+16
|
* Remove specific code handling for old version of pytestPierre Sassoulas2021-05-291-3/+0
|
* Fix Use 'from astroid import test_utils' insteadPierre Sassoulas2021-05-291-2/+1
|
* Fix unhandled AstroidSyntaxError raised by infer_named_tuple brain (#929)Andrew Haigh2021-05-291-0/+93
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Fix uncaught AstroidSyntaxErrors in namedtuple brain Ref #920. This adds a test suite and updates the infer_named_tuple brain with some additional behaviours expected by `collections.namedtuple`, specifically about rejecting invalid type and field names. Some of these cases inferred as namedtuples/`ClassDef` when they would have raised `ValueError` and some of these raise unhandled `AstroidSyntaxError`s due to attempts to parse class fakes with type names that would have raised `ValueError`. For example: from collections import namedtuple Tuple = namedtuple('X', 'abc abc') # Traceback (most recent call last): # ... # ValueError: Encountered duplicate field name: 'abc' import astroid node = astroid.extract_node(""" from collections import namedtuple Tuple = namedtuple('X', 'abc abc') Tuple """) next(node.infer()) # <ClassDef.X l.3 at 0x...> from collections import namedtuple Tuple = namedtuple('123', 'abc') # Traceback (most recent call last): # ... # ValueError: Type names and field names must be valid identifiers: '123' import astroid node = astroid.extract_node(""" from collections import namedtuple Tuple = namedtuple('123', 'abc') Tuple """) next(node.infer()) # Traceback (most recent call last): # ... # KeyError: (<function infer_named_tuple at 0x...>, <Call l.3 at 0x...>) # # During handling of the above exception, another exception occurred: # # Traceback (most recent call last): # ... # File "<unknown>", line 2 # class 123(tuple): # ^ # SyntaxError: invalid syntax # # The above exception was the direct cause of the following exception: # # Traceback (most recent call last): # ... # astroid.exceptions.AstroidSyntaxError: Parsing Python code failed: # invalid syntax (<unknown>, line 2)
* Add initial support for pattern matching py310 (#986)Marc Mueller2021-05-291-0/+176
| | | | * Add initial support for pattern matching py310 * Add typing_extensions
* Fix six.with_metaclass transformation so it doesn't break user defined ↵Artsiom Kaval2021-05-291-0/+22
| | | | | transformations (#975) * Fix six.with_metaclass transformation so it doesn't break user defined transformations
* [pre-commit.ci] pre-commit autoupdate (#997)pre-commit-ci[bot]2021-05-241-1/+1
| | | | | | | | | | | | * [pre-commit.ci] pre-commit autoupdate updates: - [github.com/asottile/pyupgrade: v2.16.0 → v2.18.2](https://github.com/asottile/pyupgrade/compare/v2.16.0...v2.18.2) * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
* Fix 930 pyreverse regression (#984)DudeNr332021-05-241-0/+12
| | | | | * Fix detection if a given module is relative to the specified file or package * Remove obsolete suppression of false-positive "no-member" * Add missing imports, do not instantiate PathFinder.
* Update check of implicit return to ignore abstract methodsAndrew Haigh2021-05-241-0/+37
| | | | | | Ref #485. To avoid additional breakage, we optionally extend is_abstract to consider functions whose body is any raise statement (not just raise NotImplementedError)
* Add check of __getitem__ signature to instance_getitemAndrew Haigh2021-05-241-8/+0
|
* Fix test definition of igetattr recursion and context_manager_inferenceAndrew Haigh2021-05-241-13/+12
| | | | | | | | | Ref #663. This test did not actually check for regression of the issue fixed in 55076ca0 (i.e. it also passed on c87bea17 before the fix was applied). Additionally, it over-specified the behaviour it was attempting to check: whether the value returned from the context manager was Uninferable was not directly relevant to the test, so when this value changed due to unrelated fixes in inference, this test failed.
* Update FunctionDef.infer_call_result to infer None with no ReturnsAndrew Haigh2021-05-241-0/+12
| | | | | Ref #485. If the function was inferred (unlike many compiler-builtins) and it contains no Return nodes, then the implicit return value is None.
* Fix inference cycle in getattr when a base is an astroid.Attribute (#934)Andrew Haigh2021-05-241-0/+59
| | | | | | | | | | | | | | | | | | * Fix inference cycle in getattr when a base is an astroid.Attribute Ref #904. `getattr` attempts to find values on `self.ancestors`, which infers each node listed in `self.bases`. Removing or resetting the context passed to ancestors allows it to infer the nodes, but opens up the possibility of cycles through recursive definitions. We should be able to infer the value of the base node correctly as a `ClassDef`. The root of this issue stems from the fact that `infer_attribute` attempts to temporarily set `context.boundnode`, but when unwrapping its changes it sets the `boundnode` to `None` instead of its previous value, which loses state and causes the inference of the `Attribute` node to have a duplicate key: once when looking up the class definition (which should have `boundnode = None`), and once when inferring the (other) attribute value (which should not have `boundnode = None`) * Update changelog