summaryrefslogtreecommitdiff
path: root/tests
Commit message (Collapse)AuthorAgeFilesLines
* Add additional guards for sixMarc Mueller2021-04-241-0/+12
|
* Remove check for six tox-environmentMarc Mueller2021-04-241-7/+0
|
* Fix crash when evaluating typing.NamedTuple (#956)Marc Mueller2021-04-211-0/+26
|
* Add inference tip for ``typing.Tuple`` (#948)Marc Mueller2021-04-211-0/+13
|
* Fix line too long in unittest_nodesPierre Sassoulas2021-04-191-2/+7
|
* Fix useless suppression of no-memberPierre Sassoulas2021-04-191-3/+3
|
* Enable checks for and fix useless suppressionPierre Sassoulas2021-04-191-3/+2
|
* Fix import order in unittest_brain.pyPierre Sassoulas2021-04-191-8/+9
|
* Add an isort configuration in setup.cfg and apply itPierre Sassoulas2021-04-1921-109/+57
| | | | Except on astroid/__init__.py because of circular imports
* Fix redefining name 'astroid' from outer scopePierre Sassoulas2021-04-191-2/+2
|
* Fix redefining name 'bases' from outer scopePierre Sassoulas2021-04-191-2/+1
|
* Fix Expression is assigned to nothingPierre Sassoulas2021-04-191-0/+1
|
* Fix Unused variable 'meth_inf'Pierre Sassoulas2021-04-191-1/+1
|
* Fix Unused variable 'ex'Pierre Sassoulas2021-04-191-2/+2
|
* Fix a yoda constant in unittest_regrtest.pyPierre Sassoulas2021-04-191-1/+1
|
* Fix legacy no-member by disabling the warningPierre Sassoulas2021-04-192-2/+6
|
* Remove conditional for having pytest, we have pytestPierre Sassoulas2021-04-191-3/+0
|
* Remove python < 3.4 compatibility code for enum modulePierre Sassoulas2021-04-191-18/+0
|
* Remove non-breaking whitespaces from the codebasePierre Sassoulas2021-04-181-1/+1
|
* Fix issue #891Pierre Sassoulas2021-04-1026-26/+26
| | | | Remove outdated COPYING and rename COPYING.LESSER
* Upgrading pyupgrade in pre-commit configurationPierre Sassoulas2021-04-101-1/+1
|
* Modify infernce tip for typing.Generic and typing.Annotated with ↵Marc Mueller2021-04-102-0/+189
| | | | | | | ``__class_getitem__`` (#931) * Modify infernce tip for typing.Generic and typing.Annotated with __class_getitem__ * Fix issue with slots caching * Clean typing.Generic from mro
* Better handling of generic aliases (#923)Marc Mueller2021-04-071-49/+167
| | | | | | * Better handling of generic aliases * Use qname for tests mro * Add inference for re.Pattern and re.Match * Add comments
* Use inference_tip for typing.TypedDict brain (#928)Marc Mueller2021-04-071-5/+2
|
* Bug pylint 4206 (#921)hippo912021-04-061-40/+250
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Takes into account the fact that inferring subscript when the node is a class may use the __class_getitem__ method of the current class instead of looking for __getitem__ in the metaclass. * OrderedDict in the collections module inherit from dict which is C coded and thus have no metaclass but starting from python3.9 it supports subscripting thanks to the __class_getitem__ method. * check_metaclass becomes a static class method because we need it in the class scope. The brain_typing module does not add a ABCMeta_typing class thus there is no need to test it. Moreover it doesn't add neither a __getitem__ to the metaclass * The brain_typing module does not add anymore _typing suffixed classes in the mro * The OrderedDict class inherits from C coded dict class and thus doesn't have a metaclass. * When trying to inherit from typing.Pattern the REPL says : TypeError: type 're.Pattern' is not an acceptable base type * The REPL says that Derived as ABCMeta for metaclass and the mro is Derived => Iterator => Iterable => object * Adds comments * Starting with Python39 some collections of the collections.abc module support subscripting thanks to __class_getitem__ method. However the wat it is implemented is not straigthforward and instead of complexifying the way __class_getitem__ is handled inside the getitem method of the ClassDef class, we prefer to hack a bit. * Thanks to __class_getitem__ method there is no need to hack the metaclass * SImplifies the inference system for typing objects before python3.9. Before python3.9 the objects of the typing module that are alias of the same objects in the collections.abc module have subscripting possibility thanks to the _GenericAlias metaclass. To mock the subscripting capability we add __class_getitem__ method on those objects. * check_metaclass_is_abc become global to be shared among different classes * Create a test class dedicated to the Collections brain * Rewrites and adds test * Corrects syntax error * Deque, defaultdict and OrderedDict are part of the _collections module which is a pure C lib. While letting those class mocks inside collections module is fair for astroid it leds to pylint acceptance tests fail. * Formatting according to black * Adds two entries * Extends the filter to determine what is subscriptable to include OrderedDict * Formatting according to black * Takes into account the fact that inferring subscript when the node is a class may use the __class_getitem__ method of the current class instead of looking for __getitem__ in the metaclass. * OrderedDict in the collections module inherit from dict which is C coded and thus have no metaclass but starting from python3.9 it supports subscripting thanks to the __class_getitem__ method. * check_metaclass becomes a static class method because we need it in the class scope. The brain_typing module does not add a ABCMeta_typing class thus there is no need to test it. Moreover it doesn't add neither a __getitem__ to the metaclass * The brain_typing module does not add anymore _typing suffixed classes in the mro * The OrderedDict class inherits from C coded dict class and thus doesn't have a metaclass. * When trying to inherit from typing.Pattern the REPL says : TypeError: type 're.Pattern' is not an acceptable base type * The REPL says that Derived as ABCMeta for metaclass and the mro is Derived => Iterator => Iterable => object * Adds comments * Starting with Python39 some collections of the collections.abc module support subscripting thanks to __class_getitem__ method. However the wat it is implemented is not straigthforward and instead of complexifying the way __class_getitem__ is handled inside the getitem method of the ClassDef class, we prefer to hack a bit. * Thanks to __class_getitem__ method there is no need to hack the metaclass * SImplifies the inference system for typing objects before python3.9. Before python3.9 the objects of the typing module that are alias of the same objects in the collections.abc module have subscripting possibility thanks to the _GenericAlias metaclass. To mock the subscripting capability we add __class_getitem__ method on those objects. * check_metaclass_is_abc become global to be shared among different classes * Create a test class dedicated to the Collections brain * Rewrites and adds test * Corrects syntax error * Deque, defaultdict and OrderedDict are part of the _collections module which is a pure C lib. While letting those class mocks inside collections module is fair for astroid it leds to pylint acceptance tests fail. * Formatting according to black * Adds two entries * Extends the filter to determine what is subscriptable to include OrderedDict * Formatting according to black * Takes into account AWhetter remarks * Deactivates access to __class_getitem__ method * OrderedDict appears in typing module with python3.7.2 * _alias function in the typing module appears with python3.7 * Formatting according to black * _alias function is used also for builtins type and not only for collections.abc ones * Adds tests for both builtins type that are subscriptable and typing builtin alias type that are also subscriptable * No need to handle builtin types in this brain. It is better suited inside brain_bulitin_inference * Adds brain to handle builtin types that are subscriptable starting with python39 * Formatting according to black * Uses partial function instead of closure in order pylint acceptance to be ok * Handling the __class_getitem__ method associated to EmptyNode for builtin types is made directly inside the getitem method * infer_typing_alias has to be an inference_tip to avoid interferences between typing module and others (collections or builtin) * Formatting * Removes useless code * Adds comment * Takes into account cdce8p remarks * Formatting * Style changes Co-authored-by: Marc Mueller <30130371+cdce8p@users.noreply.github.com>
* Prepare for 2.5.2 releaseastroid-2.5.2Pierre Sassoulas2021-03-287-1/+7
|
* Add testMarc Mueller2021-03-071-0/+6
|
* Removes dead codehippo912021-03-071-1/+0
|
* Reformats according to blackhippo912021-03-051-5/+20
|
* DIsables the test for ravel_multi_index because strangely it fails when ↵hippo912021-03-051-1/+1
| | | | numpy is imported without alias whereas it is ok when numpy is imported with an alias. It should be investigated but is probably beyond the scope of this work.
* Double the test by import numpy module without aliasing ithippo912021-03-051-75/+92
|
* Solves "Duplicates found in MROs" false positives. (#905, #916)Marc Mueller2021-02-281-0/+115
| | | | | | | * Adds inference support for all typing types that are defined through _alias function * Instead of creating a new class (by the mean of TYPING_TYPE_TEMPLATE) infer the origin class : i.e MutableSet = _alias(collections.MutableSet ...) origin is the class in collections module. Needs to add __getitem method on its metaclass so that is support indexing (MutableSet[T]). * Enable _alias mocking and testing only if python version is at least 3.7 Co-authored-by: hippo91 <guillaume.peillex@gmail.com>
* Upgrade copyrite noticePierre Sassoulas2021-02-2826-20/+48
|
* Don't transform dataclass ClassVars (#914)Marc Mueller2021-02-281-0/+12
| | | Co-authored-by: Pierre Sassoulas <pierre.sassoulas@gmail.com>
* Small improvementsMarc Mueller2021-02-281-3/+1
|
* Fix testsMarc Mueller2021-02-281-0/+3
|
* Improve typing.TypedDict inferenceMarc Mueller2021-02-281-0/+15
|
* Fix black issuesMarc Mueller2021-02-273-11/+14
|
* Numpy ufunc methods are also inferred as Uninferablehippo912021-02-211-1/+1
|
* Revert "Insures that numpy functions returning arrays are inferred only as ↵hippo912021-02-211-2/+4
| | | | | | array and not [array, Uninferable] because it could lead to false negatives." This reverts commit 4fc45c581523e4883937e1b7a5314e434e8f3125.
* Revert "Updates two tests that deal with the number of visits and the ↵hippo912021-02-211-3/+2
| | | | | | context.path" This reverts commit be78cd4a531aeb66f2c2292fb717f8c5db6e2a47.
* Use new style super when applicablePierre Sassoulas2021-02-214-4/+4
|
* Remove redundant open mode 'r' in opensPierre Sassoulas2021-02-212-3/+3
|
* Remove old future import that are no longer requiredPierre Sassoulas2021-02-211-2/+0
|
* Move from % syntax to format or f-stringsPierre Sassoulas2021-02-2113-103/+68
| | | | This is possible with python 3.6
* Remove the # coding, since PEP3120 the default is UTF8Pierre Sassoulas2021-02-2117-17/+1
|
* Update copyright noticehippo912021-02-1525-13/+38
|
* Move the unit test to unittest_brain because it needs sixhippo912021-02-122-28/+28
|
* The node.bases has not to be tweaked otherwise leads to false positive ↵hippo912021-02-121-0/+28
| | | | unused-import due to the fact that six.with_metaclass is not consumed. Adds a unittest to check that bases attribute holds a call node and that ancestors attributes returns the correct class hierarchy.
* Adds a test for property setterhippo912021-02-101-1/+10
|