<commit_before>from os import environ
from unittest import TestCase

from nose.tools import assert_true

import django_cache_url


DB = 'django.core.cache.backends.db.DatabaseCache'
DUMMY = 'django.core.cache.backends.dummy.DummyCache'
FILE = 'django.core.cache.backends.filebased.FileBasedCache'
LOCMEM = 'django.core.cache.backends.locmem.LocMemCache'
MEMCACHED = 'django.core.cache.backends.memcached.PyLibMCCache'

class TestDjangoCacheUrl(TestCase):
    def test_config_defaults_to_locmem(self):
        config = django_cache_url.config()
        assert_true(config['ENGINE'], LOCMEM)

    def test_db_url_returns_database_cache(self):
        environ['CACHE_URL'] = 'db:///super_caching_table'
        config = django_cache_url.config()
        assert_true(config['ENGINE'], DB)
        assert_true(config['LOCATION'], 'super_caching_table')

    def test_file_url_returns_file_cache(self):
        environ['CACHE_URL'] = 'file:///herp'
        config = django_cache_url.config()
        assert_true(config['ENGINE'], FILE)
        assert_true(config['LOCATION'], 'herp')
<commit_msg>equality is way better than boolean...<commit_after>from os import environ
from unittest import TestCase

from nose.tools import assert_equals

import django_cache_url


DB = 'django.core.cache.backends.db.DatabaseCache'
DUMMY = 'django.core.cache.backends.dummy.DummyCache'
FILE = 'django.core.cache.backends.filebased.FileBasedCache'
LOCMEM = 'django.core.cache.backends.locmem.LocMemCache'
MEMCACHED = 'django.core.cache.backends.memcached.PyLibMCCache'

class TestDjangoCacheUrl(TestCase):
    def test_config_defaults_to_locmem(self):
        config = django_cache_url.config()
        assert_equals(config['ENGINE'], LOCMEM)

    def test_db_url_returns_database_cache(self):
        environ['CACHE_URL'] = 'db:///super_caching_table'
        config = django_cache_url.config()
        assert_equals(config['ENGINE'], DB)
        assert_equals(config['LOCATION'], 'super_caching_table')

    def test_file_url_returns_file_cache(self):
        environ['CACHE_URL'] = 'file:///herp'
        config = django_cache_url.config()
        assert_equals(config['ENGINE'], FILE)
        assert_equals(config['LOCATION'], 'herp')

{'fraction_non_alphanumeric': 0.11772665764546685, 'fraction_numerical': 0.0, 'mean_word_length': 4.531172069825437, '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': '6128328', 'n_tokens_mistral': 724, 'n_tokens_neox': 715, 'n_words': 109}