util: add a doctest for empty sha() calls stable
authorMatt Mackall <mpm@selenic.com>
Mon, 31 Oct 2011 15:41:39 -0500
branchstable
changeset 15392 d7bfbc92a1c0
parent 15391 a5a6a9b7f3b9
child 15393 87bb6b7644f6
util: add a doctest for empty sha() calls
hgext/largefiles/lfutil.py
mercurial/util.py
tests/test-doctest.py
--- a/hgext/largefiles/lfutil.py	Thu Oct 20 17:24:59 2011 -0400
+++ b/hgext/largefiles/lfutil.py	Mon Oct 31 15:41:39 2011 -0500
@@ -443,7 +443,7 @@
     '''Returns a file descriptor and a filename corresponding to a temporary
     file in the repo's largefiles store.'''
     path = repo.join(longname)
-    util.makedirs(repo.join(path))
+    util.makedirs(path)
     return tempfile.mkstemp(prefix=prefix, dir=path)
 
 class storeprotonotcapable(Exception):
--- a/mercurial/util.py	Thu Oct 20 17:24:59 2011 -0400
+++ b/mercurial/util.py	Mon Oct 31 15:41:39 2011 -0500
@@ -74,6 +74,16 @@
 # Python compatibility
 
 def sha1(s=''):
+    '''
+    Low-overhead wrapper around Python's SHA support
+
+    >>> f = _fastsha1
+    >>> a = sha1()
+    >>> a = f()
+    >>> a.hexdigest()
+    'da39a3ee5e6b4b0d3255bfef95601890afd80709'
+    '''
+
     return _fastsha1(s)
 
 _notset = object()
--- a/tests/test-doctest.py	Thu Oct 20 17:24:59 2011 -0400
+++ b/tests/test-doctest.py	Mon Oct 31 15:41:39 2011 -0500
@@ -4,6 +4,9 @@
     del os.environ['TERM']
 import doctest
 
+import mercurial.util
+doctest.testmod(mercurial.util)
+
 import mercurial.changelog
 doctest.testmod(mercurial.changelog)
 
@@ -22,9 +25,6 @@
 import mercurial.url
 doctest.testmod(mercurial.url)
 
-import mercurial.util
-doctest.testmod(mercurial.util)
-
 import mercurial.encoding
 doctest.testmod(mercurial.encoding)