<s> from zsearch_definitions . protocols import Protocol , Subprotocol <EOL> import zsearch_definitions . protocols <EOL> import unittest <EOL> class ProtocolNameTestCase ( unittest . TestCase ) : <EOL> def setUp ( self ) : <EOL> pass <EOL> def test_from_name ( self ) : <EOL> protocol_long = "<STR_LIT>" <EOL> protocol_short = "<STR_LIT>" <EOL> from_long = Protocol . from_name ( protocol_long ) <EOL> from_short = Protocol . from_pretty_name ( protocol_short ) <EOL> self . assertEqual ( from_long . value , from_short . value ) <EOL> self . assertEqual ( from_long . value , zsearch_definitions . protocols . HTTPS . value ) <EOL> def test_subprotocols_with_bonus_underscores ( self ) : <EOL> modbus = Protocol . from_pretty_name ( "<STR_LIT>" ) <EOL> self . assertTrue ( hasattr ( modbus , "<STR_LIT>" ) ) <EOL> self . assertFalse ( hasattr ( modbus , "<STR_LIT>" ) ) <EOL> self . assertFalse ( hasattr ( modbus , "<STR_LIT>" ) ) <EOL> def test_generic_subprotocols_exposed_as_attributes ( self ) : <EOL> proto_http = Protocol . from_pretty_name ( "<STR_LIT:http>" ) <EOL> self . assertTrue ( hasattr ( proto_http , "<STR_LIT:GET>" ) ) <EOL> if __name__ == '<STR_LIT:__main__>' : <EOL> unittest . main ( ) </s>
