Tests that fileinput.input() creates a new fileinput.FileInput object, passing the given parameters unmodified to fileinput.FileInput.__init__(). Note that this test depends on the monkey patching of fileinput.FileInput done by setUp().
(self)
| 601 | self.do_test_call_input() |
| 602 | |
| 603 | def do_test_call_input(self): |
| 604 | """Tests that fileinput.input() creates a new fileinput.FileInput |
| 605 | object, passing the given parameters unmodified to |
| 606 | fileinput.FileInput.__init__(). Note that this test depends on the |
| 607 | monkey patching of fileinput.FileInput done by setUp().""" |
| 608 | files = object() |
| 609 | inplace = object() |
| 610 | backup = object() |
| 611 | mode = object() |
| 612 | openhook = object() |
| 613 | encoding = object() |
| 614 | |
| 615 | # call fileinput.input() with different values for each argument |
| 616 | result = fileinput.input(files=files, inplace=inplace, backup=backup, |
| 617 | mode=mode, openhook=openhook, encoding=encoding) |
| 618 | |
| 619 | # ensure fileinput._state was set to the returned object |
| 620 | self.assertIs(result, fileinput._state, "fileinput._state") |
| 621 | |
| 622 | # ensure the parameters to fileinput.input() were passed directly |
| 623 | # to FileInput.__init__() |
| 624 | self.assertIs(files, result.files, "files") |
| 625 | self.assertIs(inplace, result.inplace, "inplace") |
| 626 | self.assertIs(backup, result.backup, "backup") |
| 627 | self.assertIs(mode, result.mode, "mode") |
| 628 | self.assertIs(openhook, result.openhook, "openhook") |
| 629 | |
| 630 | class Test_fileinput_close(BaseFileInputGlobalMethodsTest): |
| 631 | """Unit tests for fileinput.close()""" |
no test coverage detected