<commit_before>"""
Tests for django test runner
"""
import StringIO
import unittest
import django
from django.test import TestCase, TransactionTestCase, simple 

class DjangoTestRunnerTests(TestCase):
    
    def test_failfast(self):
        class MockTestOne(TransactionTestCase):
            def runTest(self):
                assert False
        class MockTestTwo(TransactionTestCase):
            def runTest(self):
                assert False
                
        suite = unittest.TestSuite([MockTestOne(), MockTestTwo()])
        mock_stream = StringIO.StringIO()
        dtr = simple.DjangoTestRunner(verbosity=0, failfast=False, stream=mock_stream)
        result = dtr.run(suite)
        self.assertEqual(2, result.testsRun)
        self.assertEqual(2, len(result.failures))
        
        dtr = simple.DjangoTestRunner(verbosity=0, failfast=True, stream=mock_stream)<commit_msg>Corrected the tests for DjangoTestRunner so they pass under Postgres.<commit_after>"""
Tests for django test runner
"""
import StringIO
import unittest
import django
from django.test import simple

class DjangoTestRunnerTests(unittest.TestCase):

    def test_failfast(self):
        class MockTestOne(unittest.TestCase):
            def runTest(self):
                assert False
        class MockTestTwo(unittest.TestCase):
            def runTest(self):
                assert False

        suite = unittest.TestSuite([MockTestOne(), MockTestTwo()])
        mock_stream = StringIO.StringIO()
        dtr = simple.DjangoTestRunner(verbosity=0, failfast=False, stream=mock_stream)
        result = dtr.run(suite)
        self.assertEqual(2, result.testsRun)
        self.assertEqual(2, len(result.failures))

        dtr = simple.DjangoTestRunner(verbosity=0, failfast=True, stream=mock_stream)
{'fraction_non_alphanumeric': 0.08913649025069638, 'fraction_numerical': 0.004456824512534819, 'mean_word_length': 3.0, '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': '3095474', 'n_tokens_mistral': 495, 'n_tokens_neox': 481, 'n_words': 112}