Test functions and test discovery

bruno at modulix onurb at xiludom.gro
Wed Jun 14 11:00:36 CEST 2006

Ben Finney wrote:
>     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__"))

bruno desthuilliers
python -c "print '@'.join(['.'.join([w[::-1] for w in p.split('.')]) for
p in 'onurb at xiludom.gro'.split('@')])"

More information about the Python-list mailing list