<commit_before>import sys
from time import sleep

import pytest

from cachey import Cache, Scorer, nbytes

from cachey.cache import cost

def test_cost():

    assert cost(5_000, 5) == 1e-12
    assert cost(0, 5) == 1e-08
    assert cost(0, 5, .1) == 5e-08

    with pytest.raises(ZeroDivisionError):
        cost(0, 5, 0) # Effectively disable max()


def test_cache():
    c = Cache(available_bytes=nbytes(1) * 3)

    c.put('x', 1, 10)
    assert c.get('x') == 1
    assert 'x' in c

    c.put('a', 1, 10)
    c.put('b', 1, 10)<commit_msg>Remove underscore in int for compat<commit_after>import sys
from time import sleep

import pytest

from cachey import Cache, Scorer, nbytes

from cachey.cache import cost

def test_cost():

    assert cost(5000, 5) == 1e-12
    assert cost(0, 5) == 1e-08
    assert cost(0, 5, .1) == 5e-08

    with pytest.raises(ZeroDivisionError):
        cost(0, 5, 0) # Effectively disable max()


def test_cache():
    c = Cache(available_bytes=nbytes(1) * 3)

    c.put('x', 1, 10)
    assert c.get('x') == 1
    assert 'x' in c

    c.put('a', 1, 10)
    c.put('b', 1, 10)
{'fraction_non_alphanumeric': 0.14479638009049775, 'fraction_numerical': 0.06153846153846154, 'mean_word_length': 2.9784172661870505, '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': '4594732', 'n_tokens_mistral': 476, 'n_tokens_neox': 419, 'n_words': 128}