개발 도구
*********

이 장에서 설명하는 모듈은 소프트웨어를 작성하는 것을 돕습니다. 예를 들
어, "pydoc" 모듈은 모듈을 가져와서 모듈의 내용을 기반으로 설명서를 만
듭니다. "doctest" 와 "unittest" 모듈에는 예상 출력이 만들어지는지 코드
를 자동으로 실행하고 확인하는 단위 테스트를 작성하기 위한 프레임워크가
포함되어 있습니다. **2to3**는 파이썬 2.x 소스 코드를 유효한 파이썬 3.x
코드로 변환할 수 있습니다.

이 장에서 설명하는 모듈 목록은 다음과 같습니다:

* "typing" --- Support for type hints

  * Type aliases

  * NewType

  * Callable

  * Generics

  * User-defined generic types

  * The "Any" type

  * Classes, functions, and decorators

* "pydoc" --- 설명서 생성과 온라인 도움말 시스템

* "doctest" --- 대화형 파이썬 예제 테스트

  * 간단한 사용법: 독스트링에 있는 예제 확인하기

  * 간단한 사용법: 텍스트 파일에 있는 예제 확인하기

  * 작동 방법

    * 어떤 독스트링을 검사합니까?

    * 독스트링 예제는 어떻게 인식됩니까?

    * 실행 컨텍스트란 무엇입니까?

    * 예외는 어떻게 됩니까?

    * 옵션 플래그

    * 지시자

    * 경고

  * 기본 API

  * Unittest API

  * 고급 API

    * DocTest 객체

    * Example 객체

    * DocTestFinder 객체

    * DocTestParser 객체

    * DocTestRunner 객체

    * OutputChecker 객체

  * 디버깅

  * 맺음말

* "unittest" --- 단위 테스트 프레임워크

  * 기본 예시

  * 명령행 인터페이스

    * 명령행 옵션

  * 테스트 탐색(Discovery)

  * 테스트 코드 구조 잡기

  * 이전의 테스트 코드를 다시 사용하기

  * 테스트 건너뛰기와 예상된 실패

  * 부분 테스트(subtest)를 사용하여 테스트 반복 구별 짖기

  * 클래스와 함수

    * 테스트 케이스

      * 폐지된 에일리어스

    * 테스트 분류

    * 테스트를 로드하고 실행하기

      * load_tests 프로토콜

  * 클래스와 모듈 픽스쳐

    * setUpClass 와 tearDownClass

    * setUpModule 과 tearDownModule

  * 시그널 처리하기

* "unittest.mock" --- mock object library

  * Quick Guide

  * The Mock Class

    * Calling

    * Deleting Attributes

    * Mock names and the name attribute

    * Attaching Mocks as Attributes

  * The patchers

    * patch

    * patch.object

    * patch.dict

    * patch.multiple

    * patch methods: start and stop

    * patch builtins

    * TEST_PREFIX

    * Nesting Patch Decorators

    * Where to patch

    * Patching Descriptors and Proxy Objects

  * MagicMock and magic method support

    * Mocking Magic Methods

    * Magic Mock

  * Helpers

    * sentinel

    * DEFAULT

    * call

    * create_autospec

    * ANY

    * FILTER_DIR

    * mock_open

    * Autospeccing

    * Sealing mocks

* "unittest.mock" --- getting started

  * Using Mock

    * Mock Patching Methods

    * Mock for Method Calls on an Object

    * Mocking Classes

    * Naming your mocks

    * Tracking all Calls

    * Setting Return Values and Attributes

    * Raising exceptions with mocks

    * Side effect functions and iterables

    * Creating a Mock from an Existing Object

  * Patch Decorators

  * Further Examples

    * Mocking chained calls

    * Partial mocking

    * Mocking a Generator Method

    * Applying the same patch to every test method

    * Mocking Unbound Methods

    * Checking multiple calls with mock

    * Coping with mutable arguments

    * Nesting Patches

    * Mocking a dictionary with MagicMock

    * Mock subclasses and their attributes

    * Mocking imports with patch.dict

    * Tracking order of calls and less verbose call assertions

    * More complex argument matching

* 2to3 - 파이썬 2에서 파이썬 3으로 자동 코드 변환

  * 2to3 사용법

  * 변환자 목록

  * "lib2to3" - 2to3 라이브러리

* "test" --- Regression tests package for Python

  * Writing Unit Tests for the "test" package

  * Running tests using the command-line interface

* "test.support" --- Utilities for the Python test suite

* "test.support.script_helper" --- Utilities for the Python execution
  tests

파이썬 개발 모드도 보십시오: "-X" "dev" 옵션과 "PYTHONDEVMODE" 환경 변
수.
