Commit 59be7022 authored by Tres Seaver's avatar Tres Seaver

More tests for App.Extensions.FuncCode

parent fbb3b96d
...@@ -51,6 +51,37 @@ class FuncCodeTests(unittest.TestCase): ...@@ -51,6 +51,37 @@ class FuncCodeTests(unittest.TestCase):
self.assertEqual(fc.co_varnames, ('a', 'b')) self.assertEqual(fc.co_varnames, ('a', 'b'))
self.assertEqual(fc.co_argcount, 2) self.assertEqual(fc.co_argcount, 2)
def test___cmp___None(self):
def f(self):
pass
fc = self._makeOne(f, im=1)
self.failUnless(cmp(fc, None) > 0)
def test___cmp___non_FuncCode(self):
def f(self):
pass
fc = self._makeOne(f, im=1)
self.failUnless(cmp(fc, object()) > 0)
def test___cmp___w_FuncCode_same_args(self):
def f(self, a, b):
pass
def g(self, a, b):
pass
fc = self._makeOne(f, im=1)
fc2 = self._makeOne(g, im=1)
self.failUnless(cmp(fc, fc2) == 0)
def test___cmp___w_FuncCode_different_args(self):
def f(self):
pass
def g(self, a, b):
pass
fc = self._makeOne(f, im=1)
fc2 = self._makeOne(g, im=1)
self.failUnless(cmp(fc, fc2) < 0)
def test_suite(): def test_suite():
return unittest.TestSuite(( return unittest.TestSuite((
unittest.makeSuite(FuncCodeTests), unittest.makeSuite(FuncCodeTests),
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment