zenwalker
7/14/2015 - 12:49 PM

PEP-8 compatibility for unittest

PEP-8 compatibility for unittest

from unittest import TestCase as BaseTestCase
from inflection import underscore


class TestCase(BaseTestCase):
    def setUp(self):
        if hasattr(self, 'set_up'):
            self.set_up()

    def tearDown(self):
        if hasattr(self, 'tear_down'):
            self.tear_down()


for method in dir(TestCase):
    if method.startswith('assert'):
        ext_method = underscore(method)
        setattr(TestCase, ext_method, getattr(TestCase, method))