Patchwork [1,of,6] test-filecache.py: make setbeforeget test clearer

login
register
mail settings
Submitter Siddharth Agarwal
Date Nov. 16, 2013, 11:21 p.m.
Message ID <41a6a625f0d59858439e.1384644067@dev1091.prn1.facebook.com>
Download mbox | patch
Permalink /patch/2997/
State Accepted
Commit ed80cecdfc57cd5a6eac397662efd4c630ea074a
Headers show

Comments

Siddharth Agarwal - Nov. 16, 2013, 11:21 p.m.
# HG changeset patch
# User Siddharth Agarwal <sid0@fb.com>
# Date 1384639828 28800
#      Sat Nov 16 14:10:28 2013 -0800
# Node ID 41a6a625f0d59858439e2cd002f32ecd78a84179
# Parent  2325d676e14d9c0383fdc888e73cf869473f6132
test-filecache.py: make setbeforeget test clearer

'0' and 'None' as outputs tripped me up. Make the distinction between values
set externally and values computed by calling the decorated function clearer.

Patch

diff --git a/tests/test-filecache.py b/tests/test-filecache.py
--- a/tests/test-filecache.py
+++ b/tests/test-filecache.py
@@ -21,6 +21,7 @@ 
     @filecache('x')
     def cached(self):
         print 'creating'
+        return 'string from function'
 
     def invalidate(self):
         for k in self._filecache:
@@ -103,7 +104,7 @@ 
 
 def setbeforeget(repo):
     os.remove('x')
-    repo.cached = 0
+    repo.cached = 'string set externally'
     repo.invalidate()
     print repo.cached
     repo.invalidate()
diff --git a/tests/test-filecache.py.out b/tests/test-filecache.py.out
--- a/tests/test-filecache.py.out
+++ b/tests/test-filecache.py.out
@@ -20,6 +20,6 @@ 
 
 setbeforeget:
 
-0
+string set externally
 creating
-None
+string from function