Tests fileinput.isstdin() when fileinput._state is None. Ensure that it raises RuntimeError with a meaningful error message and does not modify fileinput._state
(self)
| 813 | """Unit tests for fileinput.isstdin()""" |
| 814 | |
| 815 | def test_state_is_None(self): |
| 816 | """Tests fileinput.isstdin() when fileinput._state is None. |
| 817 | Ensure that it raises RuntimeError with a meaningful error message |
| 818 | and does not modify fileinput._state""" |
| 819 | fileinput._state = None |
| 820 | with self.assertRaises(RuntimeError) as cm: |
| 821 | fileinput.isstdin() |
| 822 | self.assertEqual(("no active input()",), cm.exception.args) |
| 823 | self.assertIsNone(fileinput._state) |
| 824 | |
| 825 | def test_state_is_not_None(self): |
| 826 | """Tests fileinput.isstdin() when fileinput._state is not None. |
nothing calls this directly
no test coverage detected