<commit_before>import sys
from funcy.objects import *


### @cached_property

def test_set_cached_property():
    class A(object):
        @cached_property
        def prop(self):
            return 7

    a = A()
    assert a.prop == 7

    a.prop = 42
    assert a.prop == 42


### Monkey tests

def test_monkey():
    class A(object):
        def f(self):
            return 7

    @monkey(A)
    def f(self):
        return f.original(self) * 6

    assert A().f() == 42

<commit_msg>Test that @cached_property really caches<commit_after>import sys
from funcy.objects import *


### @cached_property

def test_set_cached_property():
    calls = [0]

    class A(object):
        @cached_property
        def prop(self):
            calls[0] += 1
            return 7

    a = A()
    assert a.prop == 7
    assert a.prop == 7
    assert calls == [1]

    a.prop = 42
    assert a.prop == 42



### Monkey tests

def test_monkey():
    class A(object):
        def f(self):
            return 7

    @monkey(A)
    def f(self):
        return f.original(self) * 6

    assert A().f() == 42


{'fraction_non_alphanumeric': 0.12157221206581353, 'fraction_numerical': 0.022851919561243144, 'mean_word_length': 1.9594594594594594, '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': '4893443', 'n_tokens_mistral': 392, 'n_tokens_neox': 356, 'n_words': 102}