Tests fileinput.fileno() when fileinput._state is None. Ensure that it raises RuntimeError with a meaningful error message and does not modify fileinput._state
(self)
| 758 | """Unit tests for fileinput.fileno()""" |
| 759 | |
| 760 | def test_state_is_None(self): |
| 761 | """Tests fileinput.fileno() when fileinput._state is None. |
| 762 | Ensure that it raises RuntimeError with a meaningful error message |
| 763 | and does not modify fileinput._state""" |
| 764 | fileinput._state = None |
| 765 | with self.assertRaises(RuntimeError) as cm: |
| 766 | fileinput.fileno() |
| 767 | self.assertEqual(("no active input()",), cm.exception.args) |
| 768 | self.assertIsNone(fileinput._state) |
| 769 | |
| 770 | def test_state_is_not_None(self): |
| 771 | """Tests fileinput.fileno() when fileinput._state is not None. |
nothing calls this directly
no test coverage detected