<commit_before># coding=utf-8
# Distributed under the MIT software license, see the accompanying
# file LICENSE or http://www.opensource.org/licenses/mit-license.php.
from unittest import TestCase

from decimal import Decimal

from qrl.core import logger
from qrl.core.blockheader import BlockHeader
from qrl.core.formulas import calc_coeff, remaining_emission

logger.initialize_default(force_console_output=True)


class TestBlockHeader(TestCase):
    def __init__(self, *args, **kwargs):
        super(TestBlockHeader, self).__init__(*args, **kwargs)

    def test_init(self):
        # TODO: Not much going on here..
        block_header = BlockHeader()
        self.assertIsNotNone(block_header) # just to avoid warnings

    def test_calc_coeff(self):
        # TODO: Verify value and required precision
        self.assertAlmostEqual(calc_coeff(100, 2), 2.302585092994046, places=10)
        # TODO: Test more values

    def test_remaining_emission(self):
        # TODO: Verify value and required precision
        print(remaining_emission(100, 2))
        self.assertEqual(remaining_emission(100, 2), Decimal('99.99999122'))
        # TODO: Test more values

<commit_msg>Fixed reward function to use 45 second blocks instead of 15<commit_after># coding=utf-8
# Distributed under the MIT software license, see the accompanying
# file LICENSE or http://www.opensource.org/licenses/mit-license.php.
from unittest import TestCase

from decimal import Decimal

from qrl.core import logger
from qrl.core.blockheader import BlockHeader
from qrl.core.formulas import calc_coeff, remaining_emission

logger.initialize_default(force_console_output=True)


class TestBlockHeader(TestCase):
    def __init__(self, *args, **kwargs):
        super(TestBlockHeader, self).__init__(*args, **kwargs)

    def test_init(self):
        # TODO: Not much going on here..
        block_header = BlockHeader()
        self.assertIsNotNone(block_header) # just to avoid warnings

    def test_calc_coeff(self):
        # TODO: Verify value and required precision
        self.assertAlmostEqual(calc_coeff(100, 2), 2.302585092994046, places=10)
        # TODO: Test more values

    def test_remaining_emission(self):
        # TODO: Verify value and required precision
        print(remaining_emission(100, 2))
        self.assertEqual(remaining_emission(100, 2), Decimal('99.99997502'))
        # TODO: Test more values


{'fraction_non_alphanumeric': 0.0872093023255814, 'fraction_numerical': 0.03571428571428571, 'mean_word_length': 3.9063136456211813, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, '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': '4098333', 'n_tokens_mistral': 757, 'n_tokens_neox': 685, 'n_words': 198}