<commit_before>import pandas as pd
from unittest2 import TestCase  # or `from unittest import ...` if on Python 3.4+
import numpy as np
import category_encoders as encoders
from category_encoders.tests.test_helpers import deep_round

a_encoding = [1, -0.7071067811865476, 0.40824829046386313]
b_encoding = [1, -5.551115123125783e-17, -0.8164965809277261]
c_encoding = [1, 0.7071067811865475, 0.4082482904638631]


class TestPolynomialEncoder(TestCase):


    def test_polynomial_encoder_preserve_dimension_1(self):
        train = ['A', 'B', 'C']
        test = ['A', 'D', 'E']

        encoder = encoders.PolynomialEncoder(handle_unknown='value', handle_missing='value')
        encoder.fit(train)
        test_t = encoder.transform(test)

        expected = [a_encoding,
                    [1, 0, 0],
                    [1, 0, 0]]<commit_msg>fixed helpers module import<commit_after>import pandas as pd
from unittest2 import TestCase  # or `from unittest import ...` if on Python 3.4+
import numpy as np
import category_encoders as encoders
from category_encoders.tests.helpers import deep_round

a_encoding = [1, -0.7071067811865476, 0.40824829046386313]
b_encoding = [1, -5.551115123125783e-17, -0.8164965809277261]
c_encoding = [1, 0.7071067811865475, 0.4082482904638631]


class TestPolynomialEncoder(TestCase):


    def test_polynomial_encoder_preserve_dimension_1(self):
        train = ['A', 'B', 'C']
        test = ['A', 'D', 'E']

        encoder = encoders.PolynomialEncoder(handle_unknown='value', handle_missing='value')
        encoder.fit(train)
        test_t = encoder.transform(test)

        expected = [a_encoding,
                    [1, 0, 0],
                    [1, 0, 0]]
{'fraction_non_alphanumeric': 0.11405055849500294, 'fraction_numerical': 0.13756613756613756, 'mean_word_length': 3.3418367346938775, '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': '357716', 'n_tokens_mistral': 733, 'n_tokens_neox': 574, 'n_words': 134}