<commit_before>from django.test import TestCase
from ..base import ViolationsLibrary
from ..exceptions import ViolationDoesNotExists


class ViolationsLibraryCase(TestCase):
    """Violations library case"""

    def setUp(self):
        self.library = ViolationsLibrary()

    def test_register(self):
        """Test register"""
        @self.library.register('dummy')
        def violation():
            pass

        self.assertEqual(self.library.get('dummy'), violation)

    def test_not_found(self):
        """Test violation not found"""
        with self.assertRaises(ViolationDoesNotExists):
            self.library.get('dummy!!!')

    def test_has(self):
        """Test has method"""
        @self.library.register('dummy')
        def violation():
            pass

        self.assertTrue(self.library.has('dummy'))
        self.assertFalse(self.library.has('dummy!!!'))<commit_msg>Use sure in violations bases tests<commit_after>import sure
from django.test import TestCase
from ..base import ViolationsLibrary
from ..exceptions import ViolationDoesNotExists


class ViolationsLibraryCase(TestCase):
    """Violations library case"""

    def setUp(self):
        self.library = ViolationsLibrary()

    def test_register(self):
        """Test register"""
        @self.library.register('dummy')
        def violation():
            pass

        self.library.get('dummy').should.be.equal(violation)

    def test_not_found(self):
        """Test violation not found"""
        self.library.get.when.called_with('dummy!!!')\
            .should.throw(ViolationDoesNotExists)

    def test_has(self):
        """Test has method"""
        @self.library.register('dummy')
        def violation():
            pass

        self.library.has('dummy').should.be.true
        self.library.has('dummy!!!').should.be.false
{'fraction_non_alphanumeric': 0.1276595744680851, 'fraction_numerical': 0.0, 'mean_word_length': 2.804979253112033, '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': '5370327', 'n_tokens_mistral': 501, 'n_tokens_neox': 483, 'n_words': 106}