##// END OF EJS Templates
Add test for when stdin is disabled
Jessica B. Hamrick -
Show More
@@ -0,0 +1,36 b''
1 {
2 "cells": [
3 {
4 "cell_type": "code",
5 "execution_count": null,
6 "metadata": {
7 "collapsed": false
8 },
9 "outputs": [],
10 "source": [
11 "name = input(\"name: \")"
12 ]
13 }
14 ],
15 "metadata": {
16 "kernelspec": {
17 "display_name": "Python 3",
18 "language": "python",
19 "name": "python3"
20 },
21 "language_info": {
22 "codemirror_mode": {
23 "name": "ipython",
24 "version": 3
25 },
26 "file_extension": ".py",
27 "mimetype": "text/x-python",
28 "name": "python",
29 "nbconvert_exporter": "python",
30 "pygments_lexer": "ipython3",
31 "version": "3.4.2"
32 }
33 },
34 "nbformat": 4,
35 "nbformat_minor": 0
36 }
@@ -89,4 +89,18 b' class TestExecute(PreprocessorTestsBase):'
89 del cell['execution_count']
89 del cell['execution_count']
90 cell['outputs'] = []
90 cell['outputs'] = []
91 output_nb, _ = preprocessor(cleaned_input_nb, res)
91 output_nb, _ = preprocessor(cleaned_input_nb, res)
92 self.assert_notebooks_equal(output_nb, input_nb)
92
93 if os.path.basename(filename) == "Disable Stdin.ipynb":
94 # We need to special-case this particular notebook, because the
95 # traceback contains machine-specific stuff like where IPython
96 # is installed. It is sufficient here to just check that an error
97 # was thrown, and that it was a StdinNotImplementedError
98 self.assertEqual(len(output_nb['cells']), 1)
99 self.assertEqual(len(output_nb['cells'][0]['outputs']), 1)
100 output = output_nb['cells'][0]['outputs'][0]
101 self.assertEqual(output['output_type'], 'error')
102 self.assertEqual(output['ename'], 'StdinNotImplementedError')
103 self.assertEqual(output['evalue'], 'raw_input was called, but this frontend does not support input requests.')
104
105 else:
106 self.assert_notebooks_equal(output_nb, input_nb)
General Comments 0
You need to be logged in to leave comments. Login now