# HG changeset patch
# User Volker Braun <vbraun@stp.dias.ie>
# Date 1364315051 -3600
# Node ID 38c7f802428600282c0a0d4c107c636067fd975b
# Parent 6a64d0b3be2791eb40f73416c4a7f9f0350a0fdd
Fix spurious unicode warning during doctests
diff --git a/doc/en/developer/conventions.rst b/doc/en/developer/conventions.rst
a
|
b
|
|
420 | 420 | Improve further function ``have_fresh_beers`` using algorithm |
421 | 421 | ``buy_a_better_fridge``:: |
422 | 422 | |
423 | | sage: have_fresh_beers('Bière de l'Yvette') # todo: not implemented |
| 423 | sage: have_fresh_beers('Bière de l\'Yvette') # todo: not implemented |
424 | 424 | Enjoy ! |
425 | 425 | |
426 | 426 | - A REFERENCES block to list books or papers (optional). This block serves |
diff --git a/sage/doctest/parsing.py b/sage/doctest/parsing.py
a
|
b
|
|
| 1 | ## -*- encoding: utf-8 -*- |
1 | 2 | """ |
2 | 3 | This module contains functions and classes that parse docstrings. |
3 | 4 | |
… |
… |
|
21 | 22 | import re, sys |
22 | 23 | import doctest |
23 | 24 | import collections |
24 | | from sage.misc.preparser import preparse |
25 | | from Cython.Build.Dependencies import strip_string_literals |
| 25 | from sage.misc.preparser import preparse, strip_string_literals |
26 | 26 | |
27 | 27 | float_regex = re.compile('([+-]?((\d*\.?\d+)|(\d+\.?))([eE][+-]?\d+)?)') |
28 | 28 | optional_regex = re.compile(r'(long time|not implemented|not tested|known bug)|([^ a-z]\s*optional\s*[:-]*((\s|\w)*))') |
… |
… |
|
71 | 71 | set([]) |
72 | 72 | sage: parse_optional_tags(" sage: print ' # long time' # not tested") |
73 | 73 | set(['not tested']) |
| 74 | |
| 75 | UTF-8 works:: |
| 76 | |
| 77 | sage: parse_optional_tags("'ěščřžýáíéďĎ'") |
| 78 | set([]) |
74 | 79 | """ |
75 | | safe, literals = strip_string_literals(string) |
| 80 | safe, literals, state = strip_string_literals(string) |
76 | 81 | first_line = safe.split('\n', 1)[0] |
77 | 82 | if '#' not in first_line: |
78 | 83 | return set() |
79 | 84 | comment = first_line[first_line.find('#')+1:] |
| 85 | comment = comment[comment.index('(')+1 : comment.rindex(')')] |
80 | 86 | # strip_string_literals replaces comments |
81 | 87 | comment = "#" + (literals[comment]).lower() |
82 | 88 | |
… |
… |
|
120 | 126 | sage: marked.abs_tol |
121 | 127 | 0.01 |
122 | 128 | """ |
123 | | safe, literals = strip_string_literals(source) |
| 129 | safe, literals, state = strip_string_literals(source) |
124 | 130 | first_line = safe.split('\n', 1)[0] |
125 | 131 | if '#' not in first_line: |
126 | 132 | return want |
127 | 133 | comment = first_line[first_line.find('#')+1:] |
| 134 | comment = comment[comment.index('(')+1 : comment.rindex(')')] |
128 | 135 | # strip_string_literals replaces comments |
129 | 136 | comment = literals[comment] |
130 | 137 | if random_marker.search(comment): |
diff --git a/sage/doctest/sources.py b/sage/doctest/sources.py
a
|
b
|
|
677 | 677 | There are 1 tests in sage/ext/c_lib.pyx that are not being run |
678 | 678 | There are 9 tests in sage/graphs/graph_plot.py that are not being run |
679 | 679 | There are 2 tests in sage/server/notebook/worksheet.py that are not being run |
680 | | doctest:229: UnicodeWarning: Unicode equal comparison failed to convert both arguments to Unicode - interpreting them as being unequal |
681 | 680 | sage: os.chdir(cwd) |
682 | 681 | """ |
683 | 682 | expected = [] |
diff --git a/sage/misc/messaging.py b/sage/misc/messaging.py
a
|
b
|
|
62 | 62 | To set default values populate ``pushover_defaults``:: |
63 | 63 | |
64 | 64 | sage: sage.misc.messaging.pushover_defaults["user"] = "USER_TOKEN" |
65 | | sage: sage.misc.messaging.pushover("Hi, how are you?"") # not tested |
| 65 | sage: sage.misc.messaging.pushover("Hi, how are you?") # not tested |
66 | 66 | |
67 | 67 | .. note:: |
68 | 68 | |