33
33
set_default_callback_accept_timeout , GatewayConnectionGuard ,
34
34
get_java_class )
35
35
from py4j .protocol import (
36
- Py4JError , Py4JJavaError , Py4JNetworkError , decode_bytearray ,
37
- encode_bytearray , escape_new_line , unescape_new_line , smart_decode )
36
+ Py4JError , Py4JJavaError , Py4JNetworkError , TypeHint , LONG_TYPE ,
37
+ decode_bytearray , encode_bytearray , escape_new_line , unescape_new_line , smart_decode )
38
38
39
39
40
40
SERVER_PORT = 25333
@@ -607,7 +607,7 @@ def internal():
607
607
class TypeConversionTest (unittest .TestCase ):
608
608
def setUp (self ):
609
609
self .p = start_example_app_process ()
610
- self .gateway = JavaGateway ()
610
+ self .gateway = JavaGateway (auto_convert = True )
611
611
612
612
def tearDown (self ):
613
613
safe_shutdown (self )
@@ -619,6 +619,8 @@ def testLongInt(self):
619
619
self .assertEqual (4 , ex .method7 (2147483648 ))
620
620
self .assertEqual (4 , ex .method7 (- 2147483649 ))
621
621
self .assertEqual (4 , ex .method7 (long (2147483648 )))
622
+ self .assertEqual (4 , ex .method7 (TypeHint (1 , LONG_TYPE )))
623
+ self .assertEqual (4 , ex .method12 ({TypeHint (1 , LONG_TYPE )}))
622
624
self .assertEqual (long (4 ), ex .method8 (3 ))
623
625
self .assertEqual (4 , ex .method8 (3 ))
624
626
self .assertEqual (long (4 ), ex .method8 (long (3 )))
0 commit comments