From e78897fb47978eeb230a9bcb8e4ce4366d94d5be Mon Sep 17 00:00:00 2001 From: user202729 <25191436+user202729@users.noreply.github.com> Date: Sun, 10 Nov 2024 18:19:54 +0700 Subject: [PATCH] Add tests for view_annotate --- src/sage/misc/cython.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/src/sage/misc/cython.py b/src/sage/misc/cython.py index f35daf1a32d..8364a6badc8 100644 --- a/src/sage/misc/cython.py +++ b/src/sage/misc/cython.py @@ -241,6 +241,23 @@ def cython(filename, verbose=0, compile_message=False, RuntimeError: Error compiling Cython file: ... ...: 'sage/misc.pxd' not found + + Test ``view_annotate``:: + + sage: cython(''' + ....: def f(int n): + ....: return n*n + ....: ''', view_annotate=True) # optional -- webbrowser + + :: + + sage: cython(''' + ....: def f(int n): + ....: return n*n + ....: ''', view_annotate=True, annotate=False) + Traceback (most recent call last): + ... + ValueError: Cannot view annotated file without creating it """ if not filename.endswith('pyx'): print("Warning: file (={}) should have extension .pyx".format(filename), file=sys.stderr)