Python test.test_support.get_original_stdout() Examples
The following are 4
code examples of test.test_support.get_original_stdout().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
test.test_support
, or try the search function
.
Example #1
Source File: test_descr.py From ironpython2 with Apache License 2.0 | 6 votes |
def test_recursions_1(self): # Testing recursion checks ... class Letter(str): def __new__(cls, letter): if letter == 'EPS': return str.__new__(cls) return str.__new__(cls, letter) def __str__(self): if not self: return 'EPS' return self # sys.stdout needs to be the original to trigger the recursion bug test_stdout = sys.stdout sys.stdout = test_support.get_original_stdout() try: # nothing should actually be printed, this should raise an exception print Letter('w') except RuntimeError: pass else: self.fail("expected a RuntimeError for print recursion") finally: sys.stdout = test_stdout
Example #2
Source File: test_descr.py From BinderFilter with MIT License | 6 votes |
def test_recursions_1(self): # Testing recursion checks ... class Letter(str): def __new__(cls, letter): if letter == 'EPS': return str.__new__(cls) return str.__new__(cls, letter) def __str__(self): if not self: return 'EPS' return self # sys.stdout needs to be the original to trigger the recursion bug test_stdout = sys.stdout sys.stdout = test_support.get_original_stdout() try: # nothing should actually be printed, this should raise an exception print Letter('w') except RuntimeError: pass else: self.fail("expected a RuntimeError for print recursion") finally: sys.stdout = test_stdout
Example #3
Source File: test_descr.py From oss-ftp with MIT License | 6 votes |
def test_recursions_1(self): # Testing recursion checks ... class Letter(str): def __new__(cls, letter): if letter == 'EPS': return str.__new__(cls) return str.__new__(cls, letter) def __str__(self): if not self: return 'EPS' return self # sys.stdout needs to be the original to trigger the recursion bug test_stdout = sys.stdout sys.stdout = test_support.get_original_stdout() try: # nothing should actually be printed, this should raise an exception print Letter('w') except RuntimeError: pass else: self.fail("expected a RuntimeError for print recursion") finally: sys.stdout = test_stdout
Example #4
Source File: test_descr.py From gcblue with BSD 3-Clause "New" or "Revised" License | 6 votes |
def test_recursions_1(self): # Testing recursion checks ... class Letter(str): def __new__(cls, letter): if letter == 'EPS': return str.__new__(cls) return str.__new__(cls, letter) def __str__(self): if not self: return 'EPS' return self # sys.stdout needs to be the original to trigger the recursion bug test_stdout = sys.stdout sys.stdout = test_support.get_original_stdout() try: # nothing should actually be printed, this should raise an exception print Letter('w') except RuntimeError: pass else: self.fail("expected a RuntimeError for print recursion") finally: sys.stdout = test_stdout