class_docstr: Tests command line interface of `tabnanny`.
class_docstr_tok: ["Tests","command","line","interface","of","`","tabnanny","`","."]
docstr: Common function to assert the behaviour of command line interface.
docstr_tok: ["Common","function","to","assert","the","behaviour","of","command","line","interface","."]
code: def validate_cmd(
      self,
      *args,
      stdout="",
      stderr="",
      partial=False,
      expect_failure=False,
  ):
      """Common function to assert the behaviour of command line interface."""
      if expect_failure:
          _, out, err = script_helper.assert_python_failure(
              "-m", "tabnanny", *args
          )
      else:
          _, out, err = script_helper.assert_python_ok(
              "-m", "tabnanny", *args
          )
      # Note: The `splitlines()` will solve the problem of CRLF(\r) added
      # by OS Windows.
      out = os.fsdecode(out)
      err = os.fsdecode(err)
      if partial:
          for std, output in ((stdout, out), (stderr, err)):
              _output = output.splitlines()
              for _std in std.splitlines():
                  with self.subTest(std=_std, output=_output):
                      self.assertIn(_std, _output)
      else:
          self.assertListEqual(out.splitlines(), stdout.splitlines())
          self.assertListEqual(err.splitlines(), stderr.splitlines())
  
imports: from unittest import TestCase, mock
  import errno
  import os
  import tabnanny
  import tokenize
  import tempfile
  import textwrap
  from test.support import captured_stderr, captured_stdout, script_helper, findfile
  from test.support.os_helper import unlink
label_desc: Use image node_id 1 for calling the TestCommandLine obj's underlying member method code with example usage: obj.validate_cmd() without return types