Show More
@@ -398,7 +398,7 def test_property_sources(): | |||
|
398 | 398 | def test_property_docstring_is_in_info_for_detail_level_0(): |
|
399 | 399 | class A(object): |
|
400 | 400 | @property |
|
401 | def foobar(): | |
|
401 | def foobar(self): | |
|
402 | 402 | """This is `foobar` property.""" |
|
403 | 403 | pass |
|
404 | 404 |
@@ -85,7 +85,7 class WarningManager: | |||
|
85 | 85 | else: |
|
86 | 86 | return None |
|
87 | 87 | |
|
88 | def __exit__(self): | |
|
88 | def __exit__(self, type_, value, traceback): | |
|
89 | 89 | if not self._entered: |
|
90 | 90 | raise RuntimeError("Cannot exit %r without entering first" % self) |
|
91 | 91 | self._module.filters = self._filters |
@@ -101,10 +101,8 def assert_warns(warning_class, func, *args, **kw): | |||
|
101 | 101 | |
|
102 | 102 | # XXX: once we may depend on python >= 2.6, this can be replaced by the |
|
103 | 103 | # warnings module context manager. |
|
104 |
|
|
|
105 | l = ctx.__enter__() | |
|
106 | warnings.simplefilter('always') | |
|
107 | try: | |
|
104 | with WarningManager(record=True) as l: | |
|
105 | warnings.simplefilter('always') | |
|
108 | 106 | func(*args, **kw) |
|
109 | 107 | if not len(l) > 0: |
|
110 | 108 | raise AssertionError("No warning raised when calling %s" |
@@ -112,5 +110,3 def assert_warns(warning_class, func, *args, **kw): | |||
|
112 | 110 | if not l[0].category is warning_class: |
|
113 | 111 | raise AssertionError("First warning for %s is not a " \ |
|
114 | 112 | "%s( is %s)" % (func.__name__, warning_class, l[0])) |
|
115 | finally: | |
|
116 | ctx.__exit__() |
@@ -39,7 +39,7 from pygments.lexer import ( | |||
|
39 | 39 | Lexer, DelegatingLexer, RegexLexer, do_insertions, bygroups, using, |
|
40 | 40 | ) |
|
41 | 41 | from pygments.token import ( |
|
42 |
|
|
|
42 | Generic, Keyword, Literal, Name, Operator, Other, Text, Error, | |
|
43 | 43 | ) |
|
44 | 44 | from pygments.util import get_bool_opt |
|
45 | 45 | |
@@ -83,13 +83,11 def build_ipy_lexer(python3): | |||
|
83 | 83 | # we will also have two IPython lexer classes. |
|
84 | 84 | if python3: |
|
85 | 85 | PyLexer = Python3Lexer |
|
86 | clsname = 'IPython3Lexer' | |
|
87 | 86 | name = 'IPython3' |
|
88 | 87 | aliases = ['ipython3'] |
|
89 | 88 | doc = """IPython3 Lexer""" |
|
90 | 89 | else: |
|
91 | 90 | PyLexer = PythonLexer |
|
92 | clsname = 'IPythonLexer' | |
|
93 | 91 | name = 'IPython' |
|
94 | 92 | aliases = ['ipython2', 'ipython'] |
|
95 | 93 | doc = """IPython Lexer""" |
@@ -468,9 +466,9 class IPythonConsoleLexer(Lexer): | |||
|
468 | 466 | if insertion: |
|
469 | 467 | self.insertions.append((len(self.buffer), [insertion])) |
|
470 | 468 | self.buffer += code |
|
471 | else: | |
|
472 |
|
|
|
473 |
|
|
|
469 | ||
|
470 | for token in self.buffered_tokens(): | |
|
471 | yield token | |
|
474 | 472 | |
|
475 | 473 | class IPyLexer(Lexer): |
|
476 | 474 | """ |
General Comments 0
You need to be logged in to leave comments.
Login now