<commit_before>

from lib.crypt import Crypt
from nose.tools import assert_equal
from nose.tools import assert_not_equal
#from nose.tools import assert_raises
#from nose.tools import raises


class TestCrypt(object):
    @classmethod
    def setup_class(klass):
        """This method is run once for each class before any tests are run"""

    @classmethod
    def teardown_class(klass):
        """This method is run once for each class _after_ all tests are run"""

    def setUp(self):
        """This method is run once before _each_ test method is executed"""
        self.crypt = Crypt()

    def teardown(self):
        """This method is run once after _each_ test method is executed"""

    def test_init(self):
        assert_equal(self.crypt.algorithm, "Fernet")
        assert_not_equal(self.crypt.algorithm, "Incorrect Value")

    def test_encrypt_and_decrypt(self):
        secret_msg = b"test message. foobar test. blub."
        token = self.crypt.encrypt(secret_msg)
        new_msg = self.crypt.decrypt(token)
        assert_equal(secret_msg, new_msg)
        assert_not_equal(secret_msg, "test message.")
        
    def test_encrypt(self):
        secret_msg = b"test message. foobar test. blub."
        token = self.crypt.encrypt(secret_msg)
        assert_equal(token.startswith('gAAAA', 0, 5), True)
        assert_not_equal(token.startswith('gAAAA', 0, 5), False)
        
#    def test_encrypt(self):
#        self.token = self.crypt.encrypt("lala")
#        print self.token
#        assert_equal(self.token, True)
#        assert_not_equal(self.token, False)
        
#    def test_decrypt(self):
#        assert_equal(self.crypt.decrypt(True, True), True)
#        assert_not_equal(self.crypt.decrypt(True, True), False)

#    def test_raise_exc(self):
#        a = A()
#        assert_raises(KeyError, a.raise_exc, "A value")<commit_msg>threat content as bytes /BB<commit_after>

from lib.crypt import Crypt
from nose.tools import assert_equal
from nose.tools import assert_not_equal
#from nose.tools import assert_raises
#from nose.tools import raises


class TestCrypt(object):
    @classmethod
    def setup_class(klass):
        """This method is run once for each class before any tests are run"""

    @classmethod
    def teardown_class(klass):
        """This method is run once for each class _after_ all tests are run"""

    def setUp(self):
        """This method is run once before _each_ test method is executed"""
        self.crypt = Crypt()

    def teardown(self):
        """This method is run once after _each_ test method is executed"""

    def test_init(self):
        assert_equal(self.crypt.algorithm, "Fernet")
        assert_not_equal(self.crypt.algorithm, "Incorrect Value")

    def test_encrypt_and_decrypt(self):
        secret_msg = b"test message. foobar test. blub."
        token = self.crypt.encrypt(secret_msg)
        new_msg = self.crypt.decrypt(token)
        assert_equal(secret_msg, new_msg)
        assert_not_equal(secret_msg, "test message.")
        
    def test_encrypt(self):
        secret_msg = b"test message. foobar test. blub."
        token = self.crypt.encrypt(secret_msg)
        token_str = str(token)
        assert_equal(token_str.startswith('gAAAA', 0, 5), True)
        assert_not_equal(token_str.startswith('gAAAA', 0, 5), False)
        
#    def test_encrypt(self):
#        self.token = self.crypt.encrypt("lala")
#        print self.token
#        assert_equal(self.token, True)
#        assert_not_equal(self.token, False)
        
#    def test_decrypt(self):
#        assert_equal(self.crypt.decrypt(True, True), True)
#        assert_not_equal(self.crypt.decrypt(True, True), False)

#    def test_raise_exc(self):
#        a = A()
#        assert_raises(KeyError, a.raise_exc, "A value")
{'fraction_non_alphanumeric': 0.10498549195462939, 'fraction_numerical': 0.0021102611448166712, 'mean_word_length': 2.9623824451410656, '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': '6497286', 'n_tokens_mistral': 1223, 'n_tokens_neox': 1175, 'n_words': 307}