Commits

Joe LaFata  committed ff6e2d7

added some tests
fixed a small bug

  • Participants
  • Parent commits 5a9bb04

Comments (0)

Files changed (2)

File src/tests/test_unitbench.py

            "[2] {\"x\":5, \"y\":True}")
         eq_(FunctionProfiler._args_to_str('', x=5, y=True),
            "[\"\"] {\"x\":5, \"y\":True}")
+        eq_(FunctionProfiler._args_to_str('', x=5, y=True, z=eq_),
+           "[\"\"] {\"x\":5, \"y\":True, \"z\":eq_}")
+        
+    def test_wrap_int(self):
+        eq_(1, FunctionProfiler._wrap_int(1)())
+        eq_(1098, FunctionProfiler._wrap_int(1098)())
+        eq_(1257, FunctionProfiler._wrap_int(1257)())
+        eq_(-99, FunctionProfiler._wrap_int(-99)())
     
 class TestBenchmark(TestCase):
     def test_warmup(self):

File src/unitbench.py

     def _to_str(x):
         if isinstance(x, str):
             return "\"" + x + "\""
-        if hasattr(x, __name__):
+        if hasattr(x, "__name__"):
             return x.__name__
         return str(x)