def _check_args(size, dstype): # Find the number of required args minus self, filename req_args = get_num_args(dstype.__init__)[1] - 2 if size < req_args: # raise IOErr('badargs', dstype.__name__, req_args) raise TypeError("data set '%s' takes at least %s args" % (dstype.__name__, req_args))
def _check_args(size, dstype): # Find the number of required args minus self, filename req_args = (get_num_args(dstype.__init__)[1] - 2) if size < req_args: # raise IOErr('badargs', dstype.__name__, req_args) raise TypeError("data set '%s' takes at least %s args" % (dstype.__name__, req_args))
def test_get_num_args(func, expected): assert utils.get_num_args(func) == expected
def test_get_num_args(self): self.assertEqual(utils.get_num_args(self.f1), (3, 3, 0)) self.assertEqual(utils.get_num_args(self.f2), (5, 1, 4)) self.assertEqual(utils.get_num_args(self.f3), (5, 0, 5))