

def test_writeable_cached_property():
    team1 = Team.objects.create(name='Team1')
    team2 = Team.objects.create(name='Team2')
    tools.assert_equal(team1.writable_cached_counter, 1)
    tools.assert_equal(team2.writable_cached_counter, 1)
    team1.writable_cached_counter = 77
    tools.assert_equal(team1.writable_cached_counter, 77)
    tools.assert_equal(Team.objects.get(pk=team1.pk).writable_cached_counter, 77)
    tools.assert_equal(team2.writable_cached_counter, 1)
    tools.assert_equal(Team.objects.get(pk=team2.pk).writable_cached_counter, 1)
    del team1.writable_cached_counter
    tools.assert_equal(team1.writable_cached_counter, 2)
    tools.assert_equal(team2.writable_cached_counter, 1)
    del team2.writable_cached_counter
    tools.assert_equal(team2.writable_cached_counter, 2)

dataset/ETHPy150Open rewardz/django_model_helpers/tests/test_cached_property.py test_writeable_cached_property/original