Tests fileinput.lineno() when fileinput._state is None. Ensure that it raises RuntimeError with a meaningful error message and does not modify fileinput._state
(self)
| 704 | """Unit tests for fileinput.lineno()""" |
| 705 | |
| 706 | def test_state_is_None(self): |
| 707 | """Tests fileinput.lineno() when fileinput._state is None. |
| 708 | Ensure that it raises RuntimeError with a meaningful error message |
| 709 | and does not modify fileinput._state""" |
| 710 | fileinput._state = None |
| 711 | with self.assertRaises(RuntimeError) as cm: |
| 712 | fileinput.lineno() |
| 713 | self.assertEqual(("no active input()",), cm.exception.args) |
| 714 | self.assertIsNone(fileinput._state) |
| 715 | |
| 716 | def test_state_is_not_None(self): |
| 717 | """Tests fileinput.lineno() when fileinput._state is not None. |
nothing calls this directly
no test coverage detected