Commits

dan mackinlay committed 0203220

gotcha, setdefault bug

  • Participants
  • Parent commits b263c68

Comments (0)

Files changed (2)

         self.__dict__ = state
         self.work_dir = path(self.work_dir)
     
-    # def setdefault(self, k, d=None):
-    #     if k not in self:
-    #         self[k] = d
-    #     return self[k]
+    def setdefault(self, k, d=None):
+        if k not in self:
+            self[k] = d
+        return self[k]
 

tests/fsdict_tests.py

     """does setdefault work as expected?"""
     d = FSDict()
     yield assert_equal, d.setdefault('a',2), 2
+    #sure, but did that REALLY go to the FS?
+    yield assert_true, (d.work_dir/'a').exists()
     yield assert_equal, d.setdefault('a',3), 2
     d.cleanup()