<commit_before>import unittest
import quite


class MyTestCase(unittest.TestCase):
    def setUp(self):
        self.table_widget = quite.TableWidget()
        self.table_widget.set_just_show_mode()
        self.table_widget.set_headers(['字符串', '整形', '浮点型'])

    def test_table_widget_row(self):
        with quite.EventLoop(0.1):
            self.table_widget.show()
            excuted = [False]

            times = []

            @quite.connect_with(self.table_widget.dict.changed)
            def test_changed(text):
                excuted[0] = True
                times.append(len(times))
                if len(times) == 0:
                    self.assertEqual(text, {'字符串': 'first', '整形': '1', '浮点型': '1.1'})
                elif len(times) == 1:
                    self.assertEqual(text, {'字符串': 'second', '整形': '2', '浮点型': '2.2'})

            self.table_widget.dict_list.value = [{'字符串': 'first', '整形': 1, '浮点型': 1.1},
                                                   {'字符串': 'second', '整形': 2, '浮点型': 2.2}]
            self.assertTrue(excuted[0])

    def test_table_widget_dict_list(self):
        with quite.EventLoop(0.1):
            self.table_widget.show()
            executed = [False]
            dict_list = [{'字符串': 'first', '整形': 1, '浮点型': 1.1},
                           {'字符串': 'second', '整形': 2, '浮点型': 2.2}]
<commit_msg>fix table_widget unittest<commit_after>import unittest
import quite


class MyTestCase(unittest.TestCase):
    def setUp(self):
        self.table_widget = quite.TableWidget()
        self.table_widget.set_just_show_mode()
        self.table_widget.set_headers(['字符串', '整形', '浮点型'])

    def test_table_widget_row(self):
        with quite.EventLoop(0.1):
            self.table_widget.show()
            excuted = [False]

            times = []

            @quite.connect_with(self.table_widget.dict.changed)
            def test_changed(text):
                excuted[0] = True
                if len(times) == 0:
                    self.assertEqual(text, {'字符串': 'first', '整形': '1', '浮点型': '1.1'})
                elif len(times) == 1:
                    self.assertEqual(text, {'字符串': 'second', '整形': '2', '浮点型': '2.2'})
                times.append(len(times))

            self.table_widget.dict_list.value = [{'字符串': 'first', '整形': 1, '浮点型': 1.1},
                                                   {'字符串': 'second', '整形': 2, '浮点型': 2.2}]
            self.assertTrue(excuted[0])

    def test_table_widget_dict_list(self):
        with quite.EventLoop(0.1):
            self.table_widget.show()
            executed = [False]
            dict_list = [{'字符串': 'first', '整形': 1, '浮点型': 1.1},
                           {'字符串': 'second', '整形': 2, '浮点型': 2.2}]

{'fraction_non_alphanumeric': 0.16299559471365638, 'fraction_numerical': 0.01908957415565345, 'mean_word_length': 1.8006166495375129, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1544952', 'n_tokens_mistral': 946, 'n_tokens_neox': 967, 'n_words': 166}