Tests fileinput.lineno() when fileinput._state is not None. Ensure that it invokes fileinput._state.lineno() exactly once, returns whatever it returns, and does not modify fileinput._state to point to a different object.
(self)
| 714 | self.assertIsNone(fileinput._state) |
| 715 | |
| 716 | def test_state_is_not_None(self): |
| 717 | """Tests fileinput.lineno() when fileinput._state is not None. |
| 718 | Ensure that it invokes fileinput._state.lineno() exactly once, |
| 719 | returns whatever it returns, and does not modify fileinput._state |
| 720 | to point to a different object.""" |
| 721 | lineno_retval = object() |
| 722 | instance = MockFileInput() |
| 723 | instance.return_values["lineno"] = lineno_retval |
| 724 | fileinput._state = instance |
| 725 | retval = fileinput.lineno() |
| 726 | self.assertExactlyOneInvocation(instance, "lineno") |
| 727 | self.assertIs(retval, lineno_retval) |
| 728 | self.assertIs(fileinput._state, instance) |
| 729 | |
| 730 | class Test_fileinput_filelineno(BaseFileInputGlobalMethodsTest): |
| 731 | """Unit tests for fileinput.filelineno()""" |
nothing calls this directly
no test coverage detected