Tests fileinput.filelineno() when fileinput._state is None. Ensure that it raises RuntimeError with a meaningful error message and does not modify fileinput._state
(self)
| 731 | """Unit tests for fileinput.filelineno()""" |
| 732 | |
| 733 | def test_state_is_None(self): |
| 734 | """Tests fileinput.filelineno() when fileinput._state is None. |
| 735 | Ensure that it raises RuntimeError with a meaningful error message |
| 736 | and does not modify fileinput._state""" |
| 737 | fileinput._state = None |
| 738 | with self.assertRaises(RuntimeError) as cm: |
| 739 | fileinput.filelineno() |
| 740 | self.assertEqual(("no active input()",), cm.exception.args) |
| 741 | self.assertIsNone(fileinput._state) |
| 742 | |
| 743 | def test_state_is_not_None(self): |
| 744 | """Tests fileinput.filelineno() when fileinput._state is not None. |
nothing calls this directly
no test coverage detected