From f6c1e4928751578937902879f566c56383f6db03 Mon Sep 17 00:00:00 2001 From: Brianna Laugher Date: Fri, 18 Feb 2011 16:52:18 +1100 Subject: [PATCH] Fix mistakes in monkeypatch doc example --- doc/monkeypatch.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/monkeypatch.txt b/doc/monkeypatch.txt index 668e9bba6..1d46ffe0a 100644 --- a/doc/monkeypatch.txt +++ b/doc/monkeypatch.txt @@ -24,14 +24,14 @@ patch this function before calling into a function which uses it:: import os.path def getssh(): # pseudo application code - return os.path.join(os.expanduser("~admin"), '.ssh') + return os.path.join(os.path.expanduser("~admin"), '.ssh') def test_mytest(monkeypatch): def mockreturn(path): return '/abc' monkeypatch.setattr(os.path, 'expanduser', mockreturn) x = getssh() - assert x == '/abc' + assert x == '/abc/.ssh' After the test function finishes the ``os.path.expanduser`` modification will be undone.