Skip to content

Commit e50cda6

Browse files
Merge pull request #255 from Tom-Hubrecht/gr-ctx-methods
gr: Add context methods
2 parents 7786fc0 + 8b7f0c6 commit e50cda6

File tree

4 files changed

+1096
-24
lines changed

4 files changed

+1096
-24
lines changed

src/flint/flintlib/types/gr.pxd

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,26 @@ from flint.flintlib.types.flint cimport (
55
flint_bitcnt_t,
66
)
77

8+
cdef extern from *:
9+
"""
10+
/*
11+
* The following functions were introduced in FLINT 3.2.0
12+
*/
13+
14+
#if __FLINT_RELEASE < 30200
15+
#define gr_min(res, x, y, ctx) GR_UNABLE
16+
#define gr_max(res, x, y, ctx) GR_UNABLE
17+
#define gr_le(x, y, ctx) T_UNKNOWN
18+
#define gr_lt(x, y, ctx) T_UNKNOWN
19+
#define gr_ge(x, y, ctx) T_UNKNOWN
20+
#define gr_gt(x, y, ctx) T_UNKNOWN
21+
#define gr_abs_le(x, y, ctx) T_UNKNOWN
22+
#define gr_abs_lt(x, y, ctx) T_UNKNOWN
23+
#define gr_abs_ge(x, y, ctx) T_UNKNOWN
24+
#define gr_abs_gt(x, y, ctx) T_UNKNOWN
25+
#endif
26+
"""
27+
828

929
cdef extern from "flint/gr.h":
1030

src/flint/test/test_docstrings.py

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,12 @@
55

66
import flint
77

8-
dunder_test_regex = re.compile(r'^(.*?)__test__\..*?\.(.*) \(line (\d+)\)$')
8+
dunder_test_regex = re.compile(r'^(.*?)__test__\.(.*?\.)(.*) \(line (\d+)\)$')
9+
10+
test_flint_at_least = {
11+
"flint.types._gr.gr_ctx.gens": 30100,
12+
"flint.types._gr.gr_ctx.neg": 30100,
13+
}
914

1015

1116
def find_doctests(module):
@@ -20,9 +25,14 @@ def find_doctests(module):
2025
m = dunder_test_regex.match(test.name)
2126
if m is not None:
2227
groups = m.groups()
23-
test.name = groups[0] + groups[1]
24-
test.lineno = int(groups[2])
25-
res.append(test)
28+
test.name = groups[0] + groups[2]
29+
test.lineno = int(groups[3])
30+
31+
if (
32+
test_flint_at_least.get("".join(groups[:3]), flint.__FLINT_RELEASE__)
33+
<= flint.__FLINT_RELEASE__
34+
):
35+
res.append(test)
2636

2737
tests.append((module_info.name, res))
2838

0 commit comments

Comments
 (0)