Tests fileinput.nextfile() when fileinput._state is None. Ensure that it raises RuntimeError with a meaningful error message and does not modify fileinput._state
(self)
| 650 | """Unit tests for fileinput.nextfile()""" |
| 651 | |
| 652 | def test_state_is_None(self): |
| 653 | """Tests fileinput.nextfile() when fileinput._state is None. |
| 654 | Ensure that it raises RuntimeError with a meaningful error message |
| 655 | and does not modify fileinput._state""" |
| 656 | fileinput._state = None |
| 657 | with self.assertRaises(RuntimeError) as cm: |
| 658 | fileinput.nextfile() |
| 659 | self.assertEqual(("no active input()",), cm.exception.args) |
| 660 | self.assertIsNone(fileinput._state) |
| 661 | |
| 662 | def test_state_is_not_None(self): |
| 663 | """Tests fileinput.nextfile() when fileinput._state is not None. |
nothing calls this directly
no test coverage detected