mirror of https://github.com/python/cpython
#11963: avoid printing messages in test_parser. Initial patch by Éric Araujo.
This commit is contained in:
parent
490cf4472e
commit
3919184014
|
@ -4,6 +4,7 @@ import sys
|
||||||
import operator
|
import operator
|
||||||
import struct
|
import struct
|
||||||
from test import support
|
from test import support
|
||||||
|
from test.script_helper import assert_python_failure
|
||||||
|
|
||||||
#
|
#
|
||||||
# First, we test that we can generate trees from valid source fragments,
|
# First, we test that we can generate trees from valid source fragments,
|
||||||
|
@ -607,10 +608,10 @@ class ParserStackLimitTestCase(unittest.TestCase):
|
||||||
|
|
||||||
def test_trigger_memory_error(self):
|
def test_trigger_memory_error(self):
|
||||||
e = self._nested_expression(100)
|
e = self._nested_expression(100)
|
||||||
print("Expecting 's_push: parser stack overflow' in next line",
|
rc, out, err = assert_python_failure('-c', e)
|
||||||
file=sys.stderr)
|
# parsing the expression will result in an error message
|
||||||
sys.stderr.flush()
|
# followed by a MemoryError (see #11963)
|
||||||
self.assertRaises(MemoryError, parser.expr, e)
|
self.assertEqual(err, b's_push: parser stack overflow\nMemoryError')
|
||||||
|
|
||||||
class STObjectTestCase(unittest.TestCase):
|
class STObjectTestCase(unittest.TestCase):
|
||||||
"""Test operations on ST objects themselves"""
|
"""Test operations on ST objects themselves"""
|
||||||
|
|
Loading…
Reference in New Issue