Example #1
0
class TestAttributeNames(unittest.TestCase):

    def setUp(self):
        """Setup the tests"""
        self.p = TranslateAttributes()

    # << Tests >>
    def testAll(self):
        """Do some tests on the attribute"""
        names =(("Text", "text"),
                ("Visible", "visible"),)
        for attribute, replaced in names:
            for pattern in ("a.%s=b", ".%s=b", "b=a.%s", "b=.%s",
                            "a.%s.b=c", ".%s.c=b", "b=a.%s.c", "b=.%s.c",
                            "a.%s.b+10=c", ".%s.c+10=b", "b=a.%s.c+10", "b=.%s.c+10",):
                test = pattern % attribute
                new = self.p.postProcessPythonText(test)
                self.assertEqual(new, pattern % replaced)
        for attribute, replaced in names:
            for pattern in ("a.%slkjlk=b", ".%slkjlk=b", "b=a.%slkjl", "b=.%slkjl",
                            "a.%slkj.b=c", ".%slkj.c=b", "b=a.%slkj.c", "b=.%slkj.c",
                            "a.%slkj.b+10=c", ".%slkj.c+10=b", "b=a.%slkj.c+10", "b=.%slkj.c+10",):
                test = pattern % attribute
                new = self.p.postProcessPythonText(test)
                self.assertNotEqual(new, pattern % replaced)
class TestAttributeNames(TestCase):
    def setUp(self):
        """Setup the tests"""
        self.p = TranslateAttributes()

    # << Tests >>
    def testAll(self):
        """Do some tests on the attribute"""
        names = (
            ("Text", "text"),
            ("Visible", "visible"),
        )
        for attribute, replaced in names:
            for pattern in (
                    "a.%s=b",
                    ".%s=b",
                    "b=a.%s",
                    "b=.%s",
                    "a.%s.b=c",
                    ".%s.c=b",
                    "b=a.%s.c",
                    "b=.%s.c",
                    "a.%s.b+10=c",
                    ".%s.c+10=b",
                    "b=a.%s.c+10",
                    "b=.%s.c+10",
            ):
                test = pattern % attribute
                new = self.p.postProcessPythonText(test)
                self.assertEqual(new, pattern % replaced)
        for attribute, replaced in names:
            for pattern in (
                    "a.%slkjlk=b",
                    ".%slkjlk=b",
                    "b=a.%slkjl",
                    "b=.%slkjl",
                    "a.%slkj.b=c",
                    ".%slkj.c=b",
                    "b=a.%slkj.c",
                    "b=.%slkj.c",
                    "a.%slkj.b+10=c",
                    ".%slkj.c+10=b",
                    "b=a.%slkj.c+10",
                    "b=.%slkj.c+10",
            ):
                test = pattern % attribute
                new = self.p.postProcessPythonText(test)
                self.assertNotEqual(new, pattern % replaced)
 def setUp(self):
     """Setup the tests"""
     self.p = TranslateAttributes()
Example #4
0
 def setUp(self):
     """Setup the tests"""
     self.p = TranslateAttributes()