I have an abstract class:
import abc
class Hello(object):
__metaclass__ = abc.ABCMeta
@abc.abstractmethod
def add(self, foo):
pass
@abc.abstractmethod
def remove(self, foo):
pass
I'm using abc for do abstract methods, so, when i do:
hello = Hello()
and this error is raised: TypeError: Can't instantiate abstract class Hello with abstract methods add, remove
So I can test this type error with:
self.assertRaises(Exception, Hello) # but this only test the constructor and i can't get the 100% of code coverage. I need call the add method and the remove method
Extra question: anybody knows how can i assert the message exception in python 2.6? (you can't use the with:
for raise assertions.)
How can i test this abstract methods for get the 100% of code coverage?