<s> import unittest <EOL> import logging <EOL> import inspect <EOL> from nose . tools import * <EOL> from ryu . lib . packet import mpls <EOL> LOG = logging . getLogger ( __name__ ) <EOL> class Test_mpls ( unittest . TestCase ) : <EOL> label = <NUM_LIT> <EOL> exp = <NUM_LIT:6> <EOL> bsb = <NUM_LIT:1> <EOL> ttl = <NUM_LIT:64> <EOL> mp = mpls . mpls ( label , exp , bsb , ttl ) <EOL> def setUp ( self ) : <EOL> pass <EOL> def tearDown ( self ) : <EOL> pass <EOL> def test_to_string ( self ) : <EOL> mpls_values = { '<STR_LIT:label>' : self . label , <EOL> '<STR_LIT>' : self . exp , <EOL> '<STR_LIT>' : self . bsb , <EOL> '<STR_LIT>' : self . ttl } <EOL> _mpls_str = '<STR_LIT:U+002C>' . join ( [ '<STR_LIT>' % ( k , repr ( mpls_values [ k ] ) ) <EOL> for k , v in inspect . getmembers ( self . mp ) <EOL> if k in mpls_values ] ) <EOL> mpls_str = '<STR_LIT>' % ( mpls . mpls . __name__ , _mpls_str ) <EOL> eq_ ( str ( self . mp ) , mpls_str ) <EOL> eq_ ( repr ( self . mp ) , mpls_str ) <EOL> def test_json ( self ) : <EOL> jsondict = self . mp . to_jsondict ( ) <EOL> mp = mpls . mpls . from_jsondict ( jsondict [ '<STR_LIT>' ] ) <EOL> eq_ ( str ( self . mp ) , str ( mp ) ) </s>
