From bbb6cb5fe6a61aa0975dcd9df11f9f648f6abba2 Mon Sep 17 00:00:00 2001 From: Nick Mathewson Date: Sun, 25 Jul 2010 15:13:04 -0400 Subject: More unit tests and documentation for the Thandy code --- lib/thandy/ServerCLI.py | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'lib/thandy/ServerCLI.py') diff --git a/lib/thandy/ServerCLI.py b/lib/thandy/ServerCLI.py index 9212846..4b6c1a6 100644 --- a/lib/thandy/ServerCLI.py +++ b/lib/thandy/ServerCLI.py @@ -15,6 +15,9 @@ def tstamp(): return time.strftime("%Y%m%d_%H%M%S", time.localtime()) def snarf(fname): + """Return a string containing the binary contents of the file named + "fname." + """ f = open(fname, 'rb') try: return f.read() @@ -22,6 +25,9 @@ def snarf(fname): f.close() def snarfObj(fname): + """Return a 2-tuple of (object, len), where the object stored in json + format in the file 'fname', and len is that file's length. + """ f = open(fname, 'r') try: length = os.fstat(f.fileno()).st_size -- cgit v1.2.3