<s> """<STR_LIT>""" <EOL> from __future__ import unicode_literals , absolute_import <EOL> import unittest <EOL> from py4j . java_gateway import JavaGateway , GatewayParameters <EOL> from py4j . tests . java_gateway_test import ( <EOL> start_example_app_process , safe_shutdown , sleep ) <EOL> class AutoConvertTest ( unittest . TestCase ) : <EOL> def setUp ( self ) : <EOL> self . p = start_example_app_process ( ) <EOL> self . gateway = JavaGateway ( <EOL> gateway_parameters = GatewayParameters ( auto_convert = True ) ) <EOL> def tearDown ( self ) : <EOL> safe_shutdown ( self ) <EOL> self . p . join ( ) <EOL> sleep ( ) <EOL> def testAutoConvert ( self ) : <EOL> sj = self . gateway . jvm . java . util . HashSet ( ) <EOL> sj . add ( "<STR_LIT:b>" ) <EOL> sj . add ( <NUM_LIT:1> ) <EOL> sp = set ( [ <NUM_LIT:1> , "<STR_LIT:b>" ] ) <EOL> self . assertTrue ( sj . equals ( sp ) ) <EOL> class SetTest ( unittest . TestCase ) : <EOL> def setUp ( self ) : <EOL> self . p = start_example_app_process ( ) <EOL> self . gateway = JavaGateway ( ) <EOL> def tearDown ( self ) : <EOL> safe_shutdown ( self ) <EOL> self . p . join ( ) <EOL> sleep ( ) <EOL> def testTreeSet ( self ) : <EOL> set1 = set ( ) <EOL> set2 = self . gateway . jvm . java . util . TreeSet ( ) <EOL> set1 . add ( "<STR_LIT:a>" ) <EOL> set2 . add ( "<STR_LIT:a>" ) <EOL> self . assertEqual ( len ( set1 ) , len ( set2 ) ) <EOL> self . assertEqual ( "<STR_LIT:a>" in set1 , "<STR_LIT:a>" in set2 ) <EOL> self . assertEqual ( repr ( set1 ) , repr ( set2 ) ) <EOL> set1 . add ( "<STR_LIT:b>" ) <EOL> set2 . add ( "<STR_LIT:b>" ) <EOL> self . assertEqual ( len ( set1 ) , len ( set2 ) ) <EOL> self . assertEqual ( "<STR_LIT:a>" in set1 , "<STR_LIT:a>" in set2 ) <EOL> self . assertEqual ( "<STR_LIT:b>" in set1 , "<STR_LIT:b>" in set2 ) <EOL> set1 . remove ( "<STR_LIT:a>" ) <EOL> set2 . remove ( "<STR_LIT:a>" ) <EOL> self . assertEqual ( len ( set1 ) , len ( set2 ) ) <EOL> self . assertEqual ( "<STR_LIT:a>" in set1 , "<STR_LIT:a>" in set2 ) <EOL> self . assertEqual ( "<STR_LIT:b>" in set1 , "<STR_LIT:b>" in set2 ) <EOL> set1 . clear ( ) <EOL> set2 . clear ( ) <EOL> self . assertEqual ( len ( set1 ) , len ( set2 ) ) <EOL> self . assertEqual ( "<STR_LIT:a>" in set1 , "<STR_LIT:a>" in set2 ) <EOL> self . assertEqual ( "<STR_LIT:b>" in set1 , "<STR_LIT:b>" in set2 ) <EOL> def testHashSet ( self ) : <EOL> set1 = set ( ) <EOL> set2 = self . gateway . jvm . java . util . HashSet ( ) <EOL> set1 . add ( "<STR_LIT:a>" ) <EOL> set2 . add ( "<STR_LIT:a>" ) <EOL> set1 . add ( <NUM_LIT:1> ) <EOL> set2 . add ( <NUM_LIT:1> ) <EOL> set1 . add ( "<STR_LIT:b>" ) <EOL> set2 . add ( "<STR_LIT:b>" ) <EOL> self . assertEqual ( len ( set1 ) , len ( set2 ) ) <EOL> self . assertEqual ( "<STR_LIT:a>" in set1 , "<STR_LIT:a>" in set2 ) <EOL> self . assertEqual ( "<STR_LIT:b>" in set1 , "<STR_LIT:b>" in set2 ) <EOL> self . assertEqual ( <NUM_LIT:1> in set1 , <NUM_LIT:1> in set2 ) <EOL> set1 . remove ( <NUM_LIT:1> ) <EOL> set2 . remove ( <NUM_LIT:1> ) <EOL> self . assertEqual ( len ( set1 ) , len ( set2 ) ) <EOL> self . assertEqual ( "<STR_LIT:a>" in set1 , "<STR_LIT:a>" in set2 ) <EOL> self . assertEqual ( "<STR_LIT:b>" in set1 , "<STR_LIT:b>" in set2 ) <EOL> self . assertEqual ( <NUM_LIT:1> in set1 , <NUM_LIT:1> in set2 ) <EOL> set1 . clear ( ) <EOL> set2 . clear ( ) <EOL> self . assertEqual ( len ( set1 ) , len ( set2 ) ) <EOL> self . assertEqual ( "<STR_LIT:a>" in set1 , "<STR_LIT:a>" in set2 ) <EOL> self . assertEqual ( "<STR_LIT:b>" in set1 , "<STR_LIT:b>" in set2 ) <EOL> self . assertEqual ( <NUM_LIT:1> in set1 , <NUM_LIT:1> in set2 ) <EOL> if __name__ == "<STR_LIT:__main__>" : <EOL> unittest . main ( ) </s>
