<s> """<STR_LIT>""" <EOL> import unittest <EOL> from exabgp . protocol . family import AFI <EOL> from exabgp . protocol . family import SAFI <EOL> from exabgp . bgp . message import Message <EOL> from exabgp . bgp . message import Open <EOL> from exabgp . bgp . message . open import Version <EOL> from exabgp . bgp . message . open import ASN <EOL> from exabgp . bgp . message . open import RouterID <EOL> from exabgp . bgp . message . open import HoldTime <EOL> from exabgp . bgp . message . open . routerid import RouterID <EOL> from exabgp . bgp . message . open . capability import Capabilities <EOL> from exabgp . bgp . message . open . capability import RouteRefresh <EOL> from exabgp . configuration . environment import environment <EOL> environment . setup ( '<STR_LIT>' ) <EOL> class TestData ( unittest . TestCase ) : <EOL> def test_1_open ( self ) : <EOL> check_capa = { <EOL> <NUM_LIT:1> : [ ( AFI . ipv4 , SAFI . unicast ) , ( AFI . ipv6 , SAFI . unicast ) ] , <EOL> <NUM_LIT:2> : RouteRefresh ( ) , <EOL> <NUM_LIT> : <NUM_LIT> L , <EOL> <NUM_LIT> : RouteRefresh ( ) , <EOL> } <EOL> message_id = <NUM_LIT:1> <EOL> body = '<STR_LIT>' . join ( [ chr ( c ) for c in [ <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> ] ] ) <EOL> negotiated = { '<STR_LIT>' : '<STR_LIT:test>' } <EOL> o = Message . unpack ( message_id , body , negotiated ) <EOL> self . assertEqual ( o . version , <NUM_LIT:4> ) <EOL> self . assertEqual ( o . asn , <NUM_LIT> ) <EOL> self . assertEqual ( o . router_id , RouterID ( '<STR_LIT>' ) ) <EOL> self . assertEqual ( o . hold_time , <NUM_LIT> ) <EOL> for k , v in o . capabilities . items ( ) : <EOL> self . assertEqual ( v , check_capa [ k ] ) <EOL> def test_2_open ( self ) : <EOL> capabilities = Capabilities ( ) <EOL> o = Open ( Version ( <NUM_LIT:4> ) , ASN ( <NUM_LIT> ) , HoldTime ( <NUM_LIT> ) , RouterID ( '<STR_LIT:127.0.0.1>' ) , capabilities ) <EOL> self . assertEqual ( o . version , <NUM_LIT:4> ) <EOL> self . assertEqual ( o . asn , <NUM_LIT> ) <EOL> self . assertEqual ( o . router_id , RouterID ( '<STR_LIT:127.0.0.1>' ) ) <EOL> self . assertEqual ( o . hold_time , <NUM_LIT> ) <EOL> self . assertEqual ( o . capabilities , { } ) <EOL> if __name__ == '<STR_LIT:__main__>' : <EOL> unittest . main ( ) </s>
