Test functions and test discovery

Ben Finney bignose+hates-spam at benfinney.id.au
Wed Jun 14 12:51:06 CEST 2006


bruno at modulix <onurb at xiludom.gro> writes:

> Ben Finney wrote:
> (snip)
> >     if __name__ == "__main__":
> >         test_funcs = [x for name, x in globals()
> >             if name.startswith("test") and hasattr(x, "__call__")
> >         ]
> 
> Any reason not to use callable(x) here ? (instead of hasattr(x, "__call__"))

Other than my ignorance until now of 'callable', no :-)

-- 
 \          "About four years ago, I was -- no, it was yesterday."  -- |
  `\                                                     Steven Wright |
_o__)                                                                  |
Ben Finney




More information about the Python-list mailing list