Show More
@@ -326,15 +326,12 b' def check_cpaste(code, should_fail=False):' | |||
|
326 | 326 | sys.stdin = src |
|
327 | 327 | |
|
328 | 328 | try: |
|
329 | _ip.magic('cpaste') | |
|
330 | except: | |
|
329 | context = tt.AssertPrints if should_fail else tt.AssertNotPrints | |
|
330 | with context("Traceback (most recent call last)"): | |
|
331 | _ip.magic('cpaste') | |
|
332 | ||
|
331 | 333 | if not should_fail: |
|
332 | raise AssertionError("Failure not expected : '%s'" % | |
|
333 | code) | |
|
334 | else: | |
|
335 | assert _ip.user_ns['code_ran'] | |
|
336 | if should_fail: | |
|
337 | raise AssertionError("Failure expected : '%s'" % code) | |
|
334 | assert _ip.user_ns['code_ran'] | |
|
338 | 335 | finally: |
|
339 | 336 | sys.stdin = stdin_save |
|
340 | 337 |
General Comments 0
You need to be logged in to leave comments.
Login now