<commit_before>from unittest import TestCase

import numpy as np
import pandas as pd

from rosie.invalid_cnpj_cpf_classifier import InvalidCnpjCpfClassifier


class TestInvalidCnpjCpfClassifier(TestCase):

    def setUp(self):
        self.dataset = pd.read_csv('tests/fixtures/invalid_cnpj_cpf_classifier.csv',
                                   dtype={'cnpj_cpf': np.str})
        self.subject = InvalidCnpjCpfClassifier()

    def test_is_valid_cnpj(self):
        self.assertEqual(self.subject.predict(self.dataset)[0], False)

    def test_is_invalid_cnpj(self):
        self.assertEqual(self.subject.predict(self.dataset)[1], True)

    def test_is_none(self):
        self.assertEqual(self.subject.predict(self.dataset)[2], True)

    def test_none_cnpj_cpf_abroad_is_valid(self):
        self.assertEqual(self.subject.predict(self.dataset)[3], False)

    def test_valid_cnpj_cpf_abroad_is_valid(self):
        self.assertEqual(self.subject.predict(self.dataset)[4], False)

    def test_invalid_cnpj_cpf_abroad_is_valid(self):
        self.assertEqual(self.subject.predict(self.dataset)[5], False)

    def test_is_valid_cpf(self):
        self.assertEqual(self.subject.predict(self.dataset)[6], False)

    def test_is_invalid_cpf(self):
        self.assertEqual(self.subject.predict(self.dataset)[7], True)

    def test_invalid_document_type(self):
        self.assertEqual(self.subject.predict(self.dataset)[8], False)
<commit_msg>adds fit and transform testing for invalid cpf cnpj<commit_after>from unittest import TestCase

import numpy as np
import pandas as pd

from rosie.invalid_cnpj_cpf_classifier import InvalidCnpjCpfClassifier


class TestInvalidCnpjCpfClassifier(TestCase):

    def setUp(self):
        self.dataset = pd.read_csv('tests/fixtures/invalid_cnpj_cpf_classifier.csv',
                                   dtype={'cnpj_cpf': np.str})
        self.subject = InvalidCnpjCpfClassifier()

    def test_is_valid_cnpj(self):
        self.assertEqual(self.subject.predict(self.dataset)[0], False)

    def test_is_invalid_cnpj(self):
        self.assertEqual(self.subject.predict(self.dataset)[1], True)

    def test_is_none(self):
        self.assertEqual(self.subject.predict(self.dataset)[2], True)

    def test_none_cnpj_cpf_abroad_is_valid(self):
        self.assertEqual(self.subject.predict(self.dataset)[3], False)

    def test_valid_cnpj_cpf_abroad_is_valid(self):
        self.assertEqual(self.subject.predict(self.dataset)[4], False)

    def test_invalid_cnpj_cpf_abroad_is_valid(self):
        self.assertEqual(self.subject.predict(self.dataset)[5], False)

    def test_is_valid_cpf(self):
        self.assertEqual(self.subject.predict(self.dataset)[6], False)

    def test_is_invalid_cpf(self):
        self.assertEqual(self.subject.predict(self.dataset)[7], True)

    def test_invalid_document_type(self):
        self.assertEqual(self.subject.predict(self.dataset)[8], False)

    def test_fit(self):
        self.assertEqual(self.subject.fit(self.dataset), self.subject)

    def test_transform(self):
        self.assertEqual(self.subject.transform(), self.subject)

{'fraction_non_alphanumeric': 0.10936497754971135, 'fraction_numerical': 0.005772931366260423, 'mean_word_length': 4.014469453376206, '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': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1759917', 'n_tokens_mistral': 1033, 'n_tokens_neox': 1006, 'n_words': 140}