<s> from unittest import main , TestCase <EOL> from vint . compat . unittest import mock <EOL> from pprint import pprint <EOL> from vint . linting . policy_set import PolicySet <EOL> from vint . linting . level import Level <EOL> from test . fixture . policy_set . policy_fixture_1 import PolicyFixture1 <EOL> from test . fixture . policy_set . policy_fixture_2 import PolicyFixture2 <EOL> @ mock . patch ( '<STR_LIT>' , lambda : { <EOL> '<STR_LIT>' : PolicyFixture1 , <EOL> '<STR_LIT>' : PolicyFixture2 , <EOL> } ) <EOL> class TestPolicySet ( TestCase ) : <EOL> def test_get_enabled_policies_when_no_updated ( self ) : <EOL> policy_set = PolicySet ( ) <EOL> expected_no_policies = policy_set . get_enabled_policies ( ) <EOL> self . assertEqual ( expected_no_policies , [ ] , <EOL> '<STR_LIT>' ) <EOL> def assertEnabledPolicies ( self , expected_enabled_policy_classes , actual_enabled_policies ) : <EOL> actual_enabled_policy_classes = { enabled_policy_class : False <EOL> for enabled_policy_class <EOL> in expected_enabled_policy_classes } <EOL> for actual_enabled_policy in actual_enabled_policies : <EOL> actual_enabled_policy_classes [ actual_enabled_policy . __class__ ] = True <EOL> pprint ( actual_enabled_policy_classes ) <EOL> assert all ( actual_enabled_policy_classes . values ( ) ) <EOL> def test_get_enabled_policies_with_a_disabled_option ( self ) : <EOL> config_dict = { <EOL> '<STR_LIT>' : { <EOL> '<STR_LIT>' : Level . WARNING , <EOL> } , <EOL> '<STR_LIT>' : { <EOL> '<STR_LIT>' : { <EOL> '<STR_LIT>' : True , <EOL> } , <EOL> '<STR_LIT>' : { <EOL> '<STR_LIT>' : False , <EOL> } , <EOL> } <EOL> } <EOL> policy_set = PolicySet ( ) <EOL> policy_set . update_by_config ( config_dict ) <EOL> actual_enabled_policies = policy_set . get_enabled_policies ( ) <EOL> expected_enabled_policy_classes = [ <EOL> PolicyFixture1 , <EOL> ] <EOL> self . assertEnabledPolicies ( expected_enabled_policy_classes , actual_enabled_policies ) <EOL> def test_get_enabled_policies_with_severity_warning ( self ) : <EOL> config_dict = { <EOL> '<STR_LIT>' : { <EOL> '<STR_LIT>' : Level . WARNING , <EOL> } , <EOL> '<STR_LIT>' : { } <EOL> } <EOL> policy_set = PolicySet ( ) <EOL> policy_set . update_by_config ( config_dict ) <EOL> actual_enabled_policies = policy_set . get_enabled_policies ( ) <EOL> expected_enabled_policy_classes = [ <EOL> PolicyFixture1 , <EOL> ] <EOL> self . assertEnabledPolicies ( expected_enabled_policy_classes , actual_enabled_policies ) <EOL> def test_get_enabled_policies_with_severity_style_problem ( self ) : <EOL> config_dict = { <EOL> '<STR_LIT>' : { <EOL> '<STR_LIT>' : Level . STYLE_PROBLEM , <EOL> } , <EOL> '<STR_LIT>' : { } <EOL> } <EOL> policy_set = PolicySet ( ) <EOL> policy_set . update_by_config ( config_dict ) <EOL> actual_enabled_policies = policy_set . get_enabled_policies ( ) <EOL> expected_enabled_policy_classes = [ <EOL> PolicyFixture1 , <EOL> PolicyFixture2 , <EOL> ] <EOL> self . assertEnabledPolicies ( expected_enabled_policy_classes , actual_enabled_policies ) <EOL> if __name__ == '<STR_LIT:__main__>' : <EOL> main ( ) </s>
