1
이 ConfigObj 사용하여, 나는 몇 가지 section 생성 코드를 테스트하려는. 유형의 인수로 TypeError
의 '모의'가 반복 가능하지 않기 때문에 예를 들어,비웃음 ConfigObj 인스턴스
def test_create_section_created():
config = Mock(spec=ConfigObj) # ← This is not right…
create_section(config, 'ook')
assert 'ook' in config
config.reload.assert_called_once_with()
분명히, 시험 방법은 실패합니다.
config
객체를 모의 객체로 정의하려면 어떻게해야합니까?