<commit_before># coding=utf-8

NORMALIZED_POWERS = {
    '0,330': ('220v', 1.5)
}

with description('A normalized power class'):
    with context('if the power is normalized'):
        with _it('must return the voltage and the intesity of this normalized power'):
            pass
    with context('if the power is not normalized'):
        with it('must raise an ValueError Exception'):
            pass
    with _it('must have a method to check if is a normalized power'):
        pass<commit_msg>Created the tests that check normalized power<commit_after># coding=utf-8
from expects import expect, raise_error

from enerdata.contracts.normalized_power import NormalizedPower

NORMALIZED_POWERS = {
    330: ('220v', '1.5')
}

NOT_NORMALIZED_POWERS = [100]

with description('A normalized power class'):
    with context('if the power is normalized'):
        with it('must return the voltage and the '
                 'intesity of this normalized power'):
            n_p = NormalizedPower()
            for normal in NORMALIZED_POWERS:
                assert n_p.get_volt_int(normal) == NORMALIZED_POWERS[normal]
    with context('if the power is not normalized'):
        with it('must raise an ValueError Exception'):
            n_p = NormalizedPower()
            for not_normal in NOT_NORMALIZED_POWERS:
                expect(
                    lambda: n_p.get_volt_int(not_normal)
                ).to(
                    raise_error(ValueError)
                )
    with it('must have a method to check if is a normalized power'):
        n_p = NormalizedPower()
        for normal in NORMALIZED_POWERS:
            assert n_p.is_normalized(normal)

        for not_normal in NOT_NORMALIZED_POWERS:
            assert not n_p.is_normalized(not_normal)
{'fraction_non_alphanumeric': 0.08031674208144797, 'fraction_numerical': 0.012443438914027148, 'mean_word_length': 2.4960474308300395, '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': '1069191', 'n_tokens_mistral': 512, 'n_tokens_neox': 501, 'n_words': 162}