<s> from __future__ import unicode_literals <EOL> from django . test import TestCase <EOL> from django . utils import six <EOL> from django_countries import countries , data <EOL> class TestSettings ( TestCase ) : <EOL> def setUp ( self ) : <EOL> del countries . countries <EOL> def tearDown ( self ) : <EOL> del countries . countries <EOL> def test_override_additional ( self ) : <EOL> with self . settings ( COUNTRIES_OVERRIDE = { '<STR_LIT>' : '<STR_LIT>' } ) : <EOL> self . assertEqual ( countries . name ( '<STR_LIT>' ) , '<STR_LIT>' ) <EOL> def test_override_replace ( self ) : <EOL> with self . settings ( COUNTRIES_OVERRIDE = { '<STR_LIT>' : '<STR_LIT>' } ) : <EOL> self . assertEqual ( countries . name ( '<STR_LIT>' ) , '<STR_LIT>' ) <EOL> def test_override_remove ( self ) : <EOL> with self . settings ( COUNTRIES_OVERRIDE = { '<STR_LIT>' : None } ) : <EOL> self . assertNotIn ( '<STR_LIT>' , countries ) <EOL> self . assertEqual ( countries . name ( '<STR_LIT>' ) , '<STR_LIT>' ) <EOL> def test_override_only ( self ) : <EOL> with self . settings ( COUNTRIES_ONLY = { '<STR_LIT>' : '<STR_LIT>' } ) : <EOL> self . assertTrue ( len ( countries . countries ) == <NUM_LIT:1> ) <EOL> self . assertIn ( '<STR_LIT>' , countries ) <EOL> self . assertEqual ( countries . name ( '<STR_LIT>' ) , '<STR_LIT>' ) <EOL> def test_common_names ( self ) : <EOL> common_code , common_name = list ( data . COMMON_NAMES . items ( ) ) [ <NUM_LIT:0> ] <EOL> common_name = six . text_type ( common_name ) <EOL> name = six . text_type ( countries . countries [ common_code ] ) <EOL> self . assertEqual ( name , common_name ) <EOL> del countries . countries <EOL> official_name = six . text_type ( data . COUNTRIES [ common_code ] ) <EOL> with self . settings ( COUNTRIES_COMMON_NAMES = False ) : <EOL> name = six . text_type ( countries . countries [ common_code ] ) <EOL> self . assertEqual ( name , official_name ) </s>
