Commit Graph

8 Commits

Author SHA1 Message Date
Kangzhi Shi
1ed18c012a fix vm.to_index now use number protocol 2022-05-30 07:36:08 +09:00
snowapril
8d507a6fbc seq: add __index__ op overriding class support
This commit fix three test cases in test_index.py
* SeqTestCase.test_index
* SeqTestCase.test_wrappers
* ListTestCase.test_setdelitem

All these three cases' failures were caused by not supporting classes
that override __index__ operator when indexing sequence type.

This commit implement almost same routine with PR(#2807) which also did not
support classes which override __index__ operator in range indexing.

Signed-off-by: snowapril <sinjihng@gmail.com>
2021-08-09 21:33:53 +09:00
Snowapril
89ca1db86d builtins: add __index__ overriding class support
This commit fix RangeTestCase.test_range test in test_index.py

TryFromObject implementation for RangeIndex enum did not cover classes
that override __index__ operator which cpython implementation is currently providing
(https://docs.python.org/3.8/library/operator.html#operator.__index__)

I add codes that cover upper case using vm.to_index method.

Signed-off-by: snowapril <sinjihng@gmail.com>
2021-08-08 21:27:05 +09:00
Robert Booth
5499920075 slice: remove expectedfailure on test_index 2021-05-02 02:54:21 +09:00
Robert Booth
af6b230dad Change int type checking, amend tests
- add a special_retrieve fudge function to the PyValue trait
- define the special_retrieve function for PyInt
- remove blocks on successful tests to reflect effect of changes
2021-04-25 01:18:57 +09:00
Padraic Fanning
67a616a650 Unmark passing tests in test_index 2021-04-14 21:02:54 -04:00
Padraic Fanning
21aeb7b08e Mark erroring/failing tests 2021-04-14 20:25:59 -04:00
Padraic Fanning
11fe49931a Add test_index from CPython 3.8.7 2021-04-14 20:25:58 -04:00