<commit_before>
''' Test case for QObject.signalsBlocked() and blockSignal()'''

import unittest
import os
from tempfile import mkstemp

from PySide.QtCore import QObject, SIGNAL, QFile, QThread, QTimer, Qt
from helper import UsesQCoreApplication

class MyThread(QThread):

    def run(self):
        self.emit(SIGNAL("test(const QString&)"), "INdT - PySide");

class TestThreadSignal(UsesQCoreApplication):

    __called__ = True
    def _callback(self, msg):
        self.assertEqual(msg, "INdT - PySide")
        self.__called__ = True
        self.app.quit()

    def testThread(self):
        t = MyThread()
        QObject.connect(t, SIGNAL("test(const QString&)"), self._callback);
        t.start()

        self.app.exec_()
        self.assert_(self.__called__);

if __name__ == '__main__':
    unittest.main()<commit_msg>Fixed thread test to avoid memory leaks.<commit_after>
''' Test case for QObject.signalsBlocked() and blockSignal()'''

import unittest
import os
from tempfile import mkstemp

from PySide.QtCore import QObject, SIGNAL, QFile, QThread, QTimer, Qt
from helper import UsesQCoreApplication

class MyThread(QThread):

    def run(self):
        self.emit(SIGNAL("test(const QString&)"), "INdT - PySide");

class TestThreadSignal(UsesQCoreApplication):

    __called__ = True
    def _callback(self, msg):
        self.assertEqual(msg, "INdT - PySide")
        self.__called__ = True
        self.app.quit()

    def testThread(self):
        t = MyThread()
        QObject.connect(t, SIGNAL("test(const QString&)"), self._callback);
        t.start()

        self.app.exec_()
        t.wait()
        self.assert_(self.__called__);

if __name__ == '__main__':
    unittest.main()
{'fraction_non_alphanumeric': 0.12192262602579132, 'fraction_numerical': 0.0, 'mean_word_length': 3.33248730964467, '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': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5756147', 'n_tokens_mistral': 548, 'n_tokens_neox': 534, 'n_words': 134}