<commit_before>try:
    from unittest2 import TestCase
except ImportError:
    from unittest import TestCase

import six

from rororo.exceptions import HTTPNotFound
from webtest import TestApp

from app import app
from views import explorer


class TestViews(TestCase):

    def test_does_not_exist(self):
        self.assertRaises(HTTPNotFound, explorer, '/does_not_exist')

    def test_exists(self):
        listing = explorer('')
        self.assertTrue(listing)


class TestWebTest(TestCase):

    def setUp(self):
        self.client = TestApp(app)

    def test_does_not_exist(self):
        self.client.get('/does_not_exist.exe', status=404)

    def test_index(self):
        response = self.client.get('/', status=200)
        self.assertIn('<title>File Explorer</title>', response.ubody)


class TestWebTestWithoutWdb(TestCase):

    def setUp(self):
        self.old_USE_WDB = app.settings.USE_WDB
        app.settings.USE_WDB = False

        self.client = TestApp(app)

    def tearDown(self):<commit_msg>Fix explorer tests for 2.6, add test for favicon handling.<commit_after>try:
    from unittest2 import TestCase
except ImportError:
    from unittest import TestCase

import sys

import six

from rororo.exceptions import HTTPNotFound
from webtest import TestApp

from app import app, settings
from views import explorer


class TestViews(TestCase):

    def test_does_not_exist(self):
        self.assertRaises(HTTPNotFound, explorer, '/does_not_exist')

    def test_exists(self):
        listing = explorer('')
        self.assertTrue(listing)


class TestWebTest(TestCase):

    def setUp(self):
        self.client = TestApp(app)

    def test_does_not_exist(self):
        if sys.version[:2] == (2, 6):
            self.assertRaises(HTTPNotFound,
                              self.client.get,
                              '/does_not_exist.exe')
        else:
            self.client.get('/does_not_exist.exe', status=404)

    def test_favicon(self):
        favicon = open(settings.rel('static', 'favicon.ico')).read()
        response = self.client.get('/favicon.ico', status=200)
        self.assertEqual(response.body, favicon)

    def test_index(self):
        response = self.client.get('/', status=200)
        self.assertIn('<title>File Explorer</title>', response.ubody)


class TestWebTestWithoutWdb(TestCase):

    def setUp(self):
        self.old_USE_WDB = app.settings.USE_WDB
        app.settings.USE_WDB = False

        self.client = TestApp(app)

    def tearDown(self):
{'fraction_non_alphanumeric': 0.1025844930417495, 'fraction_numerical': 0.00874751491053678, 'mean_word_length': 2.9747235387045814, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, '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': '3070628', 'n_tokens_mistral': 796, 'n_tokens_neox': 748, 'n_words': 171}