MCPcopy Index your code
hub / github.com/python/cpython / do_test_call_input

Method do_test_call_input

Lib/test/test_fileinput.py:603–628  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

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
630class Test_fileinput_close(BaseFileInputGlobalMethodsTest):
631 """Unit tests for fileinput.close()"""

Calls 2

inputMethod · 0.45
assertIsMethod · 0.45

Tested by

no test coverage detected