10000 gh-109802: Increase test coverage for complexobject.c by skirpichev · Pull Request #112452 · python/cpython · GitHub
[go: up one dir, main page]

Skip to content

gh-109802: Increase test coverage for complexobject.c #112452

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 46 commits into from
Nov 28, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
46 commits
Select commit Hold shift + click to select a range
facb60b
gh-109802: Increase test coverage for complexobject.c
skirpichev Sep 20, 2023
deff888
* c_powu: L166
skirpichev Sep 20, 2023
8a7b344
* complex_hash: L411, L414, L423
skirpichev Sep 20, 2023
e383167
* to_complex: L443, L449, L453-454
skirpichev Sep 20, 2023
85fae1a
* complex_sub: L474, L475
skirpichev Sep 20, 2023
406c375
* complex_mul: L485, L486
skirpichev Sep 20, 2023
aba6fb4
* complex_div: L496, L497
skirpichev Sep 20, 2023
204e2ec
* complex_pow: L512, L513, L522
skirpichev Sep 20, 2023
b67e8d6
* complex_pos: L555-L559
skirpichev Sep 20, 2023
85f6994
* complex_richcompare: L595, L616, L621, L625
skirpichev Sep 20, 2023
ffd088a
* complex_from_string_inner: L786, L804
skirpichev Sep 20, 2023
72b349d
* complex_subtype_from_string: L860, L871-L874 (the function called i…
skirpichev Sep 20, 2023
c25563c
* complex_new_impl: L944, L951, L958, L965, L985, L994
skirpichev Sep 20, 2023
e1c247f
* complex_bool: L580
skirpichev Sep 21, 2023
0a8679f
Merge branch 'main' into complex-cov
skirpichev Sep 24, 2023
f96c0ce
Merge branch 'main' into complex-cov
skirpichev Sep 25, 2023
fbd035d
Merge branch 'main' into complex-cov
skirpichev Nov 11, 2023
64f2174
Apply suggestions from code review
skirpichev Nov 12, 2023
b99dcfc
Merge branch 'main' into complex-cov
skirpichev Nov 12, 2023
2ef7d25
address review: self.assertAlmostEqual -> self.assertEqual (except one)
skirpichev Nov 12, 2023
75fda9c
address review: spam support classes
skirpichev Nov 12, 2023
36ee551
address review: comment on assert in complex_new_impl()
skirpichev Nov 12, 2023
aafe16e
address review: revert _Py_c_pow()
skirpichev Nov 12, 2023
f88c4bc
address review: hash test
skirpichev Nov 12, 2023
443efd5
Merge branch 'complex-cov' of github.com:skirpichev/cpython into comp…
skirpichev Nov 12, 2023
a2b6e73
* _Py_c_pow: L135-136, also other tests for _Py_c_* C API
skirpichev Nov 13, 2023
32d9f7f
+1
skirpichev Nov 13, 2023
9e21cc1
address review:
skirpichev Nov 14, 2023
3494b0d
address review: comment in complex_hash()
skirpichev Nov 14, 2023
17236ee
address review: simplify _PY_C_FUNC2 macro
skirpichev Nov 14, 2023
f7c9b0b
Merge branch 'main' into complex-cov
skirpichev Nov 16, 2023
aea52ed
Drop pycore_complexobject.h
skirpichev Nov 16, 2023
589a2e4
+ test _Py_c_abs()
skirpichev Nov 16, 2023
2f63950
Oops, typo fixed
skirpichev Nov 27, 2023
f73c907
address review: check for failures in test code before PyTuple_Pack'ing
skirpichev Nov 27, 2023
86c3647
address review: use _testcapi.DBL_MAX instead of magic numbers
skirpichev Nov 27, 2023
e2bdcec
Merge branch 'main' into complex-cov
skirpichev Nov 27, 2023
a6dce93
Revert all changes in Objects/complexobject.c
skirpichev Nov 27, 2023
4b4931b
Amend f73c90731f
skirpichev Nov 27, 2023
4d437b2
+ use Py_BuildValue
skirpichev Nov 27, 2023
2859fbe
+1
skirpichev Nov 27, 2023
c69d405
address review: drop _Py_ADJUST_ERANGE2
skirpichev Nov 27, 2023
9b431af
address review: +use Py_BuildValue
skirpichev Nov 27, 2023
2d5e5d1
Merge branch 'main' into complex-cov-tests
skirpichev Nov 28, 2023
c27feaa
+1
skirpichev Nov 28, 2023
d3b9fbf
Adjust test (due to removing _Py_ADJUST_ERANGE1 macro)
skirpichev Nov 28, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
* complex_richcompare: L595, L616, L621, L625
  • Loading branch information
skirpichev committed Sep 24, 2023
commit 85f69946fe44dc9d4e8ad0898f109371f7466b4c
2 changes: 2 additions & 0 deletions Lib/test/test_complex.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,7 @@ def test_floordiv_zero_division(self):
def test_richcompare(self):
self.assertIs(complex.__eq__(1+1j, 1<<10000), False)
self.assertIs(complex.__lt__(1+1j, None), NotImplemented)
self.assertIs(complex.__eq__(1+1j, None), NotImplemented)
self.assertIs(complex.__eq__(1+1j, 1+1j), True)
self.assertIs(complex.__eq__(1+1j, 2+2j), False)
self.assertIs(complex.__ne__(1+1j, 1+1j), False)
Expand All @@ -164,6 +165,7 @@ def test_richcompare(self):
self.assertIs(operator.eq(1+1j, 2+2j), False)
self.assertIs(operator.ne(1+1j, 1+1j), False)
self.assertIs(operator.ne(1+1j, 2+2j), True)
self.assertIs(operator.eq(1+1j, 2.0), False)

def test_richcompare_boundaries(self):
def check(n, deltas, is_equal, imag = 0.0):
Expand Down
4 changes: 2 additions & 2 deletions Objects/complexobject.c
Original file line number Diff line number Diff line change
Expand Up @@ -591,7 +591,7 @@ complex_richcompare(PyObject *v, PyObject *w, int op)
}

assert(PyComplex_Check(v));
TO_COMPLEX(v, i);
i = ((PyComplexObject*)v)->cval;

if (PyLong_Check(w)) {
/* Check for 0.0 imaginary part first to avoid the rich
Expand All @@ -617,7 +617,7 @@ complex_richcompare(PyObject *v, PyObject *w, int op)
else if (PyComplex_Check(w)) {
Py_complex j;

TO_COMPLEX(w, j);
j = ((PyComplexObject*)w)->cval;
equal = (i.real == j.real && i.imag == j.imag);
}
else {
Expand Down
0