Skip to content

Commit

Permalink
src/sage/ext/fast_callable.pyx: Add tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Matthias Koeppe committed Jun 18, 2023
1 parent 12c04b8 commit afd3be6
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion src/sage/ext/fast_callable.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -476,6 +476,8 @@ def _builder_and_stream(vars, domain):
r"""
Return a builder and a stream.
This is an internal function used only once, by :func:`fast_callable`.
INPUT:
- ``vars`` -- a sequence of variable names
Expand All @@ -485,12 +487,26 @@ def _builder_and_stream(vars, domain):
OUTPUT: A :class:`Wrapper`, an class:`InstructionStream`
EXAMPLES:
EXAMPLES::
sage: from sage.ext.fast_callable import _builder_and_stream
sage: _builder_and_stream(["x", "y"], ZZ)
(<class 'sage.ext.interpreters.wrapper_el.Wrapper_el'>,
<sage.ext.fast_callable.InstructionStream object at 0x...>)
sage: _builder_and_stream(["x", "y"], RR) # optional - sage.rings.real_mpfr
(<class 'sage.ext.interpreters.wrapper_rr.Wrapper_rr'>,
<sage.ext.fast_callable.InstructionStream object at 0x...>)
Modularized test with sagemath-categories after :issue:`35095`, which has
(a basic version of) ``RDF`` but not the specialized interpreter for it.
In this case, the function falls back to using the :class:`Element`
interpreter::
sage: domain = RDF
sage: from sage.structure.element import Element as domain # optional - sage.modules
sage: _builder_and_stream(["x", "y"], domain)
(<class 'sage.ext.interpreters.wrapper_el.Wrapper_el'>,
<sage.ext.fast_callable.InstructionStream object at 0x...>)
"""
if isinstance(domain, sage.rings.abc.RealField):
try:
Expand Down

0 comments on commit afd3be6

Please sign in to comment.