<commit_before>import pytest

from py_wlc import Discount

TOLERANCE = 0.0001

@pytest.fixture(scope='module')
def green_book():
    return Discount(2010)

@pytest.fixture(scope='module')
def complex_discount():
    return Discount(2010, year_zero=2014)


class TestStandardDiscount:
    """Test a simple Discount against Green Book rates."""

    def test_setup(self, green_book):
        assert green_book.base_year == green_book.year_zero
        assert abs(green_book._final_rate - 0.01) < TOLERANCE

    def test_rates(self, green_book):
        assert abs(green_book._rate(-10)) < TOLERANCE
        assert abs(green_book._rate(400) - 0.01) < TOLERANCE

    def test_factors(self, green_book):
        assert abs(green_book[2005] - 1.0) < TOLERANCE
        assert abs(green_book[2020] - 0.7089) < TOLERANCE
        assert abs(green_book[2030] - 0.5026) < TOLERANCE
        assert abs(green_book[2050] - 0.2651) < TOLERANCE
        assert abs(green_book[2135] - 0.0274) < TOLERANCE

    def test_parent_magic_methods(self, green_book):
        book_two = Discount(2010)
        assert green_book == book_two
        assert hash(green_book) == hash(book_two)
        assert len(book_two) == 1
        for year in book_two:
            assert year == 0<commit_msg>Improved branch coverage<commit_after>import pytest

from py_wlc import Discount

TOLERANCE = 0.0001

@pytest.fixture(scope='module')
def green_book():
    return Discount(2010)

@pytest.fixture(scope='module')
def complex_discount():
    return Discount(2010, year_zero=2014)


class TestStandardDiscount:
    """Test a simple Discount against Green Book rates."""

    def test_setup(self, green_book):
        assert green_book.base_year == green_book.year_zero
        assert abs(green_book._final_rate - 0.01) < TOLERANCE

    def test_rates(self, green_book):
        assert abs(green_book._rate(-10)) < TOLERANCE
        assert abs(green_book._rate(400) - 0.01) < TOLERANCE

    def test_factors(self, green_book):
        assert abs(green_book[2005] - 1.0) < TOLERANCE
        assert abs(green_book[2030] - 0.5026) < TOLERANCE
        assert abs(green_book[2020] - 0.7089) < TOLERANCE
        assert abs(green_book[2050] - 0.2651) < TOLERANCE
        assert abs(green_book[2135] - 0.0274) < TOLERANCE

    def test_parent_magic_methods(self, green_book):
        book_two = Discount(2010)
        assert green_book == book_two
        hash_ = hash(green_book)
        assert hash_ == hash(book_two)
        assert hash(green_book) == hash_
        assert len(book_two) == 1
        for year in book_two:
            assert year == 0
{'fraction_non_alphanumeric': 0.10399079048349961, 'fraction_numerical': 0.05832693783576362, 'mean_word_length': 3.1645367412140577, 'pattern_counts': {'":': 0, '<': 19, '<?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': '4802071', 'n_tokens_mistral': 990, 'n_tokens_neox': 878, 'n_words': 192}