1
그래서 pymox을 설치하고 나는이 방법을 테스트 할 것 : 나는 pymox 문서를 읽고있다이 코드를 pymox로 단위 테스트하는 방법은 무엇입니까?
class HttpStorage():
def download(self, input, output):
try:
file_to_download = urllib2.urlopen(input)
except URLError:
raise IOError("Opening input URL failed")
f = open(output, "wb")
f.write(file_to_download.read())
f.close()
return True
하지만 난 그것을 수행하는 방법을 알아낼 수 없습니다. 몇 가지 예제 코드로 도와 주시겠습니까?
조금 화제가되었지만'pymox'를 전혀 사용하지 않는 이유는 무엇입니까? stdlib'unittest' 모듈은 정말 잘 보입니다. –