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

Method test_version

Lib/test/test_optparse.py:951–959  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

949
950class TestVersion(BaseTest):
951 def test_version(self):
952 self.parser = InterceptingOptionParser(usage=SUPPRESS_USAGE,
953 version="%prog 0.1")
954 save_argv = sys.argv[:]
955 try:
956 sys.argv[0] = os.path.join(os.curdir, "foo", "bar")
957 self.assertOutput(["--version"], "bar 0.1\n")
958 finally:
959 sys.argv[:] = save_argv
960
961 def test_no_version(self):
962 self.parser = InterceptingOptionParser(usage=SUPPRESS_USAGE)

Callers

nothing calls this directly

Calls 3

assertOutputMethod · 0.80
joinMethod · 0.45

Tested by

no test coverage detected