View module source on GitHub

FalsyCache

class FalsyCache(MaximCache)

A cache that evaluates to False but is not None - used to test the ‘cache is not None’ fix.

TestMaximCacheHandling

class TestMaximCacheHandling(unittest.TestCase)

Test the cache handling changes, specifically the ‘if cache is not None:’ fix.

setUp

def setUp()

Set up test fixtures.

tearDown

def tearDown()

Clean up after tests.

test_enable_prompt_management_with_none_cache

def test_enable_prompt_management_with_none_cache()

Test enable_prompt_management with cache=None.

test_enable_prompt_management_with_falsy_cache

def test_enable_prompt_management_with_falsy_cache()

Test enable_prompt_management with a cache that evaluates to False but is not None.

This tests the fix from ‘if cache:’ to ‘if cache is not None:’. Previously, a falsy cache would not be used even if it was a valid cache object.

test_enable_prompt_management_with_valid_cache

def test_enable_prompt_management_with_valid_cache()

Test enable_prompt_management with a normal valid cache.

test_enable_prompt_management_starts_sync_thread

def test_enable_prompt_management_starts_sync_thread()

Test that enable_prompt_management starts the sync thread.

test_enable_exceptions_method_chaining

def test_enable_exceptions_method_chaining()

Test enable_exceptions method returns self for chaining.

TestMaximInitialization

class TestMaximInitialization(unittest.TestCase)

Test Maxim initialization and configuration.

setUp

def setUp()

Set up test fixtures.

tearDown

def tearDown()

Clean up after tests.

test_maxim_requires_api_key

def test_maxim_requires_api_key()

Test that Maxim requires an API key.

test_maxim_uses_env_api_key

def test_maxim_uses_env_api_key()

Test that Maxim uses environment variable for API key.

test_maxim_singleton_pattern

def test_maxim_singleton_pattern()

Test that Maxim follows singleton pattern.

test_maxim_default_cache_creation

def test_maxim_default_cache_creation()

Test that Maxim creates default cache when none provided.

test_cleanup_method_stops_running

def test_cleanup_method_stops_running()

Test that cleanup method properly sets is_running to False.

test_cleanup_prevents_double_execution

def test_cleanup_prevents_double_execution()

Test that cleanup method can be called multiple times safely.

TestGetConfigDict

class TestGetConfigDict(unittest.TestCase)

Test the get_config_dict function.

test_get_config_dict_with_config_object

def test_get_config_dict_with_config_object()

Test get_config_dict function with Config object.

test_get_config_dict_with_dict

def test_get_config_dict_with_dict()

Test get_config_dict function with dictionary.