{
    "mode": "pydoc",
    "parameter": "test",
    "section": "",
    "url": "https://www.chedong.com/phpMan.php/pydoc/test/json",
    "generated": "2026-06-02T15:49:33Z",
    "sections": {
        "NAME": {
            "content": "test - # Dummy file to make this directory a package.\n",
            "subsections": []
        },
        "MODULE REFERENCE": {
            "content": "https://docs.python.org/3.10/library/test.html\n\nThe following documentation is automatically generated from the Python\nsource files.  It may be incomplete, incorrect or include features that\nare considered implementation detail and may vary between Python\nimplementations.  When in doubt, consult the module reference at the\nlocation listed above.\n",
            "subsections": []
        },
        "PACKAGE CONTENTS": {
            "content": "main\nannmodule\nannmodule2\nannmodule3\nlibregrtest (package)\nregrtest\nsupport (package)\ntestsupport\n",
            "subsections": []
        },
        "FILE": {
            "content": "/usr/lib/python3.10/test/init.py\n\n",
            "subsections": []
        }
    },
    "summary": "test - # Dummy file to make this directory a package.",
    "flags": [],
    "examples": [],
    "see_also": [],
    "tldr": {
        "source": "official",
        "description": "Check file types and compare values.",
        "examples": [
            {
                "description": "Test if a given variable is equal to a given string",
                "command": "test \"{{$MY_VAR}}\" = \"{{/bin/zsh}}\""
            },
            {
                "description": "Test if a given variable is empty ([z]ero length)",
                "command": "test -z \"{{$GIT_BRANCH}}\""
            },
            {
                "description": "Test if a [f]ile exists",
                "command": "test -f \"{{path/to/file_or_directory}}\""
            },
            {
                "description": "Test if a [d]irectory does not exist",
                "command": "test ! -d \"{{path/to/directory}}\""
            },
            {
                "description": "If A is true, then do B, or C in the case of an error (notice that C may run even if A fails)",
                "command": "test {{condition}} && {{echo \"true\"}} || {{echo \"false\"}}"
            },
            {
                "description": "Use `test` in a conditional statement",
                "command": "if test -f \"{{path/to/file}}\"; then echo \"File exists\"; else echo \"File does not exist\"; fi"
            }
        ]
    }
}