<s> import unittest <EOL> import os <EOL> from mock import patch <EOL> class TestConfigurationLoading ( unittest . TestCase ) : <EOL> def setUp ( self ) : <EOL> super ( TestConfigurationLoading , self ) . setUp ( ) <EOL> self . _reset_config ( ) <EOL> def tearDown ( self ) : <EOL> super ( TestConfigurationLoading , self ) . tearDown ( ) <EOL> self . _reset_config ( ) <EOL> def _reset_config ( self ) : <EOL> """<STR_LIT>""" <EOL> from furious . config import get_config <EOL> from furious . config import default_config <EOL> config = get_config ( ) <EOL> get_config ( ) . clear ( ) <EOL> config . update ( default_config ( ) ) <EOL> def test_completion_config ( self ) : <EOL> from furious . config import get_completion_cleanup_delay <EOL> from furious . config import get_completion_cleanup_queue <EOL> from furious . config import get_completion_default_queue <EOL> expected = '<STR_LIT:default>' <EOL> queue = get_completion_cleanup_queue ( ) <EOL> self . assertEqual ( queue , expected ) <EOL> queue = get_completion_default_queue ( ) <EOL> self . assertEqual ( queue , expected ) <EOL> expected = <NUM_LIT> <EOL> delay = get_completion_cleanup_delay ( ) <EOL> self . assertEqual ( delay , expected ) <EOL> def test_load_yaml_config ( self ) : <EOL> """<STR_LIT>""" <EOL> from furious . config import _load_yaml_config <EOL> contents = _load_yaml_config ( os . path . join ( '<STR_LIT>' , '<STR_LIT>' ) ) <EOL> e = '<STR_LIT>' <EOL> self . assertEqual ( contents , e ) <EOL> @ patch ( '<STR_LIT>' , autospec = True ) <EOL> def test_not_find_yaml ( self , mock_exists ) : <EOL> """<STR_LIT>""" <EOL> mock_exists . return_value = False <EOL> from furious . config import find_furious_yaml <EOL> config_yaml_path = find_furious_yaml ( ) <EOL> self . assertIsNone ( config_yaml_path ) <EOL> def test_get_config ( self ) : <EOL> """<STR_LIT>""" <EOL> from furious . config import _parse_yaml_config <EOL> example_yaml = str ( '<STR_LIT>' <EOL> '<STR_LIT>' <EOL> '<STR_LIT>' ) <EOL> my_config = _parse_yaml_config ( example_yaml ) <EOL> self . assertEqual ( my_config , { '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : '<STR_LIT:default>' , <EOL> '<STR_LIT>' : <NUM_LIT> , <EOL> '<STR_LIT>' : '<STR_LIT:default>' } ) <EOL> def test_get_configured_persistence_exists ( self ) : <EOL> """<STR_LIT>""" <EOL> from furious . config import _parse_yaml_config <EOL> example_yaml = str ( '<STR_LIT>' <EOL> '<STR_LIT>' <EOL> '<STR_LIT>' ) <EOL> my_config = _parse_yaml_config ( example_yaml ) <EOL> from furious import config <EOL> config . _config = my_config <EOL> persistence_module = config . get_default_persistence_engine ( <EOL> { '<STR_LIT>' : '<STR_LIT>' } ) <EOL> self . assertEqual ( persistence_module , config ) <EOL> def test_get_config_invalid_yaml ( self ) : <EOL> """<STR_LIT>""" <EOL> from furious . config import InvalidYamlFile <EOL> from furious . config import _parse_yaml_config <EOL> example_yaml = str ( '<STR_LIT>' <EOL> '<STR_LIT>' <EOL> '<STR_LIT>' ) <EOL> self . assertRaises ( InvalidYamlFile , _parse_yaml_config , example_yaml ) <EOL> def test_get_configured_module_by_path ( self ) : <EOL> """<STR_LIT>""" <EOL> from furious . config import _get_configured_module <EOL> from furious import config <EOL> config . get_config ( ) [ '<STR_LIT>' ] = '<STR_LIT>' <EOL> module = _get_configured_module ( '<STR_LIT>' ) <EOL> self . assertEqual ( module , config ) <EOL> def test_get_configured_module_by_name ( self ) : <EOL> """<STR_LIT>""" <EOL> from furious . config import _get_configured_module <EOL> from furious import async <EOL> from furious import config <EOL> known_modules = { '<STR_LIT>' : '<STR_LIT>' } <EOL> config . get_config ( ) [ '<STR_LIT>' ] = '<STR_LIT>' <EOL> module = _get_configured_module ( '<STR_LIT>' , known_modules ) <EOL> self . assertEqual ( module , async ) <EOL> def test_get_config_empty_yaml ( self ) : <EOL> """<STR_LIT>""" <EOL> from furious . config import default_config <EOL> from furious . config import _parse_yaml_config <EOL> example_yaml = str ( '<STR_LIT>' ) <EOL> my_config = _parse_yaml_config ( example_yaml ) <EOL> self . assertEqual ( my_config , default_config ( ) ) </s>
