#16306: Fix multiple error messages when unknown command line parameters where passed to the interpreter.  Patch by Hieu Nguyen.
diff --git a/Lib/test/test_cmd_line.py b/Lib/test/test_cmd_line.py
index 7d039ee..d8f2443 100644
--- a/Lib/test/test_cmd_line.py
+++ b/Lib/test/test_cmd_line.py
@@ -7,7 +7,8 @@
 import sys
 import subprocess
 import tempfile
-from test.script_helper import spawn_python, kill_python, assert_python_ok, assert_python_failure
+from test.script_helper import (spawn_python, kill_python, assert_python_ok,
+    assert_python_failure)
 
 
 # XXX (ncoghlan): Move to script_helper and make consistent with run_python
@@ -376,6 +377,12 @@
         assert_python_ok(filename)
 
 
+    def test_unknown_options(self):
+        rc, out, err = assert_python_failure('-z', __cleanenv=True)
+        self.assertIn(b'Unknown option', err)
+        self.assertEqual(err.splitlines().count(b'Unknown option: -z'), 1)
+        self.assertEqual(b'', out)
+
 def test_main():
     test.support.run_unittest(CmdLineTest)
     test.support.reap_children()