dulwich.tests.test_lru_cache module

Tests for the lru_cache module.

class dulwich.tests.test_lru_cache.TestLRUCache(methodName='runTest')

Bases: TestCase

Test that LRU cache properly keeps track of entries.

Create an instance of the class that will use the named test method when executed. Raises a ValueError if the instance does not have a method with the specified name.

test_add__null_key()
test_after_cleanup_larger_than_max()
test_after_cleanup_none()
test_by_usage()

Accessing entries bumps them up in priority.

test_cache_size()
test_cleanup()

Test that we can use a cleanup function.

test_cleanup_2()
test_cleanup_on_replace()

Replacing an object should cleanup the old value.

test_cleanup_shrinks_to_after_clean_count()
test_get()
test_keys()
test_len()
test_map_None()
test_missing()
test_overflow()

Adding extra entries will pop out old ones.

test_preserve_last_access_order()
test_resize_larger()
test_resize_smaller()
class dulwich.tests.test_lru_cache.TestLRUSizeCache(methodName='runTest')

Bases: TestCase

Create an instance of the class that will use the named test method when executed. Raises a ValueError if the instance does not have a method with the specified name.

test_add__null_key()
test_add_tracks_size()
test_adding_clears_cache_based_on_size()

The cache is cleared in LRU order until small enough

test_adding_clears_to_after_cleanup_size()
test_basic_init()
test_cleanup()
test_custom_sizes()
test_keys()
test_no_add_over_size()

Adding a large value may not be cached at all.

test_no_add_over_size_cleanup()

If a large value is not cached, we will call cleanup right away.

test_remove_tracks_size()
test_resize_larger()
test_resize_smaller()