[Pyunit-interest] assertRaises question
Brought to you by:
purcell
From: <in...@mj...> - 2002-05-31 07:04:43
|
hello according to the documenation, assertRaises expects a function to test as a 2nd argument but I have this class: -------- class IllegalFormatException(exceptions.Exception): pass class Address(object): def __init__(self): self.firstname = "" self.lastname = "" self._email = "" def set_email(self, email): if re.match(".*@.*\..*", email): self._email = email else: raise IllegalFormatException, "wrong argument" def get_email(self): return self._email email = property(get_email, set_email, None, 'email adress') ----------- now I want to test if addr = Address() addr.email = "wrong" raises an Exception. how can I test this with assertRaises ??? markus |