<s> import sys <EOL> sys . path . insert ( <NUM_LIT:0> , "<STR_LIT>" ) <EOL> import unittest <EOL> from impacket import wps <EOL> import array <EOL> class TestTLVContainer ( unittest . TestCase ) : <EOL> def testNormalUsageContainer ( self ) : <EOL> BUILDERS = { <EOL> <NUM_LIT:1> : wps . StringBuilder ( ) , <EOL> <NUM_LIT:2> : wps . ByteBuilder ( ) , <EOL> <NUM_LIT:3> : wps . NumBuilder ( <NUM_LIT:2> ) <EOL> } <EOL> tlvc = wps . TLVContainer ( builders = BUILDERS ) <EOL> KINDS_N_VALUES = ( <EOL> ( <NUM_LIT:1> , "<STR_LIT>" ) , <EOL> ( <NUM_LIT:2> , <NUM_LIT:1> ) , <EOL> ( <NUM_LIT:3> , <NUM_LIT> ) , <EOL> ( <NUM_LIT:4> , array . array ( "<STR_LIT:B>" , [ <NUM_LIT:1> , <NUM_LIT:2> , <NUM_LIT:3> ] ) ) <EOL> ) <EOL> for k , v in KINDS_N_VALUES : <EOL> tlvc . append ( k , v ) <EOL> tlvc2 = wps . TLVContainer ( builders = BUILDERS ) <EOL> tlvc2 . from_ary ( tlvc . to_ary ( ) ) <EOL> for k , v in KINDS_N_VALUES : <EOL> self . assertEqual ( v , tlvc2 . first ( k ) ) <EOL> self . assertEqual ( tlvc . to_ary ( ) , tlvc2 . to_ary ( ) ) <EOL> self . assertEquals ( "<STR_LIT>" , tlvc . first ( <NUM_LIT:1> ) ) <EOL> suite = unittest . TestLoader ( ) . loadTestsFromTestCase ( TestTLVContainer ) <EOL> unittest . TextTestRunner ( verbosity = <NUM_LIT:2> ) . run ( suite ) </s>
