def test_prefix(self): """ If a prefix is given, L{accumulateMethods} limits its results to methods beginning with that prefix. Keys in the resulting dictionary also have the prefix removed from them. """ x = Separate() output = {} accumulateMethods(x, output, 'good_') self.assertEqual({'method': x.good_method}, output)
def test_ownClass(self): """ If x is and instance of Base and Base defines a method named method, L{accumulateMethods} adds an item to the given dictionary with C{"method"} as the key and a bound method object for Base.method value. """ x = Base() output = {} accumulateMethods(x, output) self.assertEqual({"method": x.method}, output)
def _getAsserts(self): dct = {} accumulateMethods(self, dct, 'assert') return [ dct[k] for k in dct if not k.startswith('Not') and k != '_' ]
def _getAsserts(self): dct = {} accumulateMethods(self, dct, 'assert') return [dct[k] for k in dct if not k.startswith('Not') and k != '_']
def _getAsserts(self): dct = {} accumulateMethods(self, dct, "assert") return [dct[k] for k in dct if not k.startswith("Not") and k != "_"]