On 8/4/06, Kevin Dangoor <[EMAIL PROTECTED]> wrote:

I'm not sure what you mean. That except clause up there will only handle ValueErrors. Anything else that comes up will "error" the test. (Not a failure, mind you, but it still wouldn't pass..)

because even if it goes in the last assert will make it always fail
    try:
        raise NotImplementedError
    except NotImplementedError:
        assert True,"True passes"
    assert False,"but here it crashes"

>python -u "assertTest.py"
Traceback (most recent call last):
  File "assertTest.py", line 5, in ?
    assert False,"but here it crashes"
AssertionError: but here it crashes
>Exit code: 1

You could also use a boolean if you want.

got_exception = False
try:
    do_something()
except NotImplementedError:
    got_exception = True
assert got_exception

now that one does pass, but then if you have more then one exception to catch, they you will have to print out the exception name or something. I believe for now using Alberto's idea is better. although I posted a ticket and I got the correct answer. http://nose.python-hosting.com/ticket/80

import nose.tools

@nose.tools.raises(NotImplementedError)
def test_something():


...


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "TurboGears" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/turbogears
-~----------~----~----~----~------~----~------~--~---

Reply via email to