class QtFormatCheckTest(CheckTestCase):
    check = QtFormatCheck()
    flag = "qt-format"

    def setUp(self):
        super().setUp()
        self.test_highlight = (self.flag, "%1string%2", [(0, 2, "%1"),
                                                         (8, 10, "%2")])

    def test_no_format(self):
        self.assertFalse(self.check.check_format("strins", "string", False))

    def test_simple_format(self):
        self.assertFalse(
            self.check.check_format("%1 strins", "%1 string", False))

    def test_missing_format(self):
        self.assertTrue(self.check.check_format("%1 strins", "string", False))

    def test_wrong_format(self):
        self.assertTrue(
            self.check.check_format("%1 string", "%2 string", False))

    def test_reordered_format(self):
        self.assertFalse(
            self.check.check_format("%1 string %2", "%2 string %1", False))

    def test_reused_format(self):
        self.assertFalse(
            self.check.check_format("%1 string %1", "%1 string %1", False))
class QtFormatCheckTest(CheckTestCase):
    check = QtFormatCheck()
    flag = 'qt-format'

    def setUp(self):
        super().setUp()
        self.test_highlight = (self.flag, '%1string%2', [(0, 2, '%1'), (8, 10, '%2')])

    def test_no_format(self):
        self.assertFalse(self.check.check_format('strins', 'string', False))

    def test_simple_format(self):
        self.assertFalse(self.check.check_format('%1 strins', '%1 string', False))

    def test_missing_format(self):
        self.assertTrue(self.check.check_format('%1 strins', 'string', False))

    def test_wrong_format(self):
        self.assertTrue(self.check.check_format('%1 string', '%2 string', False))

    def test_reordered_format(self):
        self.assertFalse(self.check.check_format('%1 string %2', '%2 string %1', False))

    def test_reused_format(self):
        self.assertFalse(self.check.check_format('%1 string %1', '%1 string %1', False))