<s> import time <EOL> import pyfora <EOL> import os <EOL> import ufora . FORA . python . PurePython . ExecutorTestCases as ExecutorTestCases <EOL> import ufora . test . PerformanceTestReporter as PerformanceTestReporter <EOL> class InMemoryExecutorTestCases ( ExecutorTestCases . ExecutorTestCases ) : <EOL> def test_list_hashing ( self ) : <EOL> def f ( x ) : <EOL> x = x [ <NUM_LIT:0> ] <EOL> res = <NUM_LIT:0> <EOL> while x > <NUM_LIT:0> : <EOL> x = x - <NUM_LIT:1> <EOL> res = res + x <EOL> return res <EOL> t0 = time . time ( ) <EOL> self . evaluateWithExecutor ( f , [ <NUM_LIT> ] ) <EOL> t1 = time . time ( ) <EOL> self . evaluateWithExecutor ( f , [ <NUM_LIT> ] ) <EOL> t2 = time . time ( ) <EOL> self . evaluateWithExecutor ( f , [ <NUM_LIT> ] ) <EOL> t3 = time . time ( ) <EOL> firstPass = t1 - t0 <EOL> secondPass = t2 - t1 <EOL> thirdPass = t3 - t2 <EOL> self . assertTrue ( thirdPass / firstPass < <NUM_LIT> ) <EOL> self . assertTrue ( thirdPass / secondPass < <NUM_LIT> ) <EOL> def test_list_comprehension_perf ( self ) : <EOL> def f ( totalCt ) : <EOL> return sum ( [ sum ( [ x for x in xrange ( ct ) ] ) for ct in xrange ( totalCt ) ] ) <EOL> self . evaluateWithExecutor ( f , <NUM_LIT> ) <EOL> @ PerformanceTestReporter . PerfTest ( "<STR_LIT>" ) <EOL> def runTest ( ) : <EOL> self . evaluateWithExecutor ( f , <NUM_LIT> ) <EOL> runTest ( ) <EOL> def test_class_identities ( self ) : <EOL> class IdentClass : <EOL> def __init__ ( self , a , b , e , c , d ) : <EOL> self . a = a <EOL> self . d = d <EOL> self . e = e <EOL> self . e = e + <NUM_LIT:1.0> <EOL> self . b = b <EOL> self . c = c <EOL> inst = IdentClass ( <NUM_LIT:1> , <NUM_LIT:2> , <NUM_LIT:3> , <NUM_LIT:4> , <NUM_LIT:5> ) <EOL> def getMembers ( inst ) : <EOL> return __inline_fora ( <EOL> """<STR_LIT>""" <EOL> ) ( inst ) <EOL> with self . create_executor ( ) as ufora : <EOL> with ufora . remotely . downloadAll ( ) : <EOL> inst2 = IdentClass ( <NUM_LIT:1> , <NUM_LIT:2> , <NUM_LIT:3> , <NUM_LIT:4> , <NUM_LIT:5> ) <EOL> shouldBeTrue = type ( inst ) is type ( IdentClass ( <NUM_LIT:1> , <NUM_LIT:2> , <NUM_LIT:3> , <NUM_LIT:4> , <NUM_LIT:5> ) ) <EOL> shouldBeTrue2 = type ( inst2 ) is type ( IdentClass ( <NUM_LIT:1> , <NUM_LIT:2> , <NUM_LIT:3> , <NUM_LIT:4> , <NUM_LIT:5> ) ) <EOL> shouldBeTrue3 = type ( inst ) is IdentClass <EOL> shouldBeTrue4 = type ( inst2 ) is IdentClass <EOL> shouldBeTrue5 = inst is inst2 <EOL> instMembs = getMembers ( inst ) <EOL> instMembs2 = getMembers ( inst2 ) <EOL> self . assertEqual ( instMembs , instMembs2 ) <EOL> self . assertTrue ( shouldBeTrue ) <EOL> self . assertTrue ( shouldBeTrue2 ) <EOL> self . assertTrue ( shouldBeTrue3 ) <EOL> self . assertTrue ( shouldBeTrue4 ) <EOL> self . assertTrue ( shouldBeTrue5 ) <EOL> def test_classInstIsInstance ( self ) : <EOL> class X : <EOL> def dot ( self , other ) : <EOL> return dot_ ( self , other ) <EOL> def dot_ ( self , other ) : <EOL> return X <EOL> with self . create_executor ( ) as ufora : <EOL> with ufora . remotely : <EOL> a = X ( ) <EOL> b = X ( ) <EOL> with ufora . remotely . downloadAll ( ) : <EOL> c = X ( ) <EOL> res = ( isinstance ( a , X ) , isinstance ( b , X ) , isinstance ( c , X ) ) <EOL> self . assertEqual ( res , ( True , True , True ) ) <EOL> def test_with_blocks_inside_converted_code ( self ) : <EOL> with self . assertRaises ( pyfora . InvalidPyforaOperation ) : <EOL> with self . create_executor ( ) as executor : <EOL> with executor . remotely : <EOL> with <NUM_LIT:10> : <EOL> X = <NUM_LIT:10> <EOL> def test_pyfora_pass_future_into_with_block_works ( self ) : <EOL> with self . create_executor ( ) as executor : <EOL> s3 = self . getS3Interface ( executor ) <EOL> payload = "<STR_LIT>" <EOL> s3 ( ) . setKeyValue ( "<STR_LIT>" , "<STR_LIT:key>" , payload ) <EOL> remote = executor . importS3Dataset ( "<STR_LIT>" , "<STR_LIT:key>" ) <EOL> with executor . remotely . downloadAll ( ) : <EOL> res = len ( remote ) <EOL> assert res == len ( payload ) <EOL> def test_pyfora_s3_read ( self ) : <EOL> with self . create_executor ( ) as executor : <EOL> s3 = self . getS3Interface ( executor ) <EOL> payload = "<STR_LIT>" <EOL> s3 ( ) . setKeyValue ( "<STR_LIT>" , "<STR_LIT:key>" , payload ) <EOL> remote = executor . importS3Dataset ( "<STR_LIT>" , "<STR_LIT:key>" ) . result ( ) <EOL> remoteResult = remote . toLocal ( ) . result ( ) <EOL> self . assertEqual ( payload , remoteResult ) <EOL> assert s3 is not None <EOL> def test_pyfora_s3_read_bad_bucket ( self ) : <EOL> with self . create_executor ( ) as executor : <EOL> with self . assertRaises ( pyfora . ComputationError ) : <EOL> result = executor . importS3Dataset ( "<STR_LIT>" , "<STR_LIT:key>" ) . result ( ) <EOL> result . toLocal ( ) . result ( ) <EOL> def test_pyfora_s3_read_bad_key ( self ) : <EOL> with self . create_executor ( ) as executor : <EOL> s3 = self . getS3Interface ( executor ) <EOL> payload = "<STR_LIT>" <EOL> s3 ( ) . setKeyValue ( "<STR_LIT>" , "<STR_LIT:key>" , payload ) <EOL> with self . assertRaises ( pyfora . ComputationError ) : <EOL> result = executor . importS3Dataset ( "<STR_LIT>" , "<STR_LIT>" ) . result ( ) <EOL> result . toLocal ( ) . result ( ) <EOL> def test_pyfora_s3_write_badKey ( self ) : <EOL> with self . create_executor ( ) as executor : <EOL> s3 = self . getS3Interface ( executor ) <EOL> def f ( ) : <EOL> return "<STR_LIT>" <EOL> remote = executor . submit ( f ) . result ( ) <EOL> noneOrExceptionFuture = executor . exportS3Dataset ( remote , "<STR_LIT>" , <NUM_LIT:10> ) <EOL> with self . assertRaises ( pyfora . PyforaError ) : <EOL> noneOrExceptionFuture . result ( ) <EOL> def test_pyfora_s3_write_valueNotString ( self ) : <EOL> with self . create_executor ( ) as executor : <EOL> s3 = self . getS3Interface ( executor ) <EOL> def f ( ) : <EOL> return <NUM_LIT:10> <EOL> remote = executor . submit ( f ) . result ( ) <EOL> noneOrExceptionFuture = executor . exportS3Dataset ( remote , "<STR_LIT>" , "<STR_LIT:key>" ) <EOL> with self . assertRaises ( pyfora . PyforaError ) : <EOL> noneOrExceptionFuture . result ( ) <EOL> def test_pyfora_s3_write_succeeds ( self ) : <EOL> with self . create_executor ( ) as executor : <EOL> s3 = self . getS3Interface ( executor ) <EOL> def f ( ) : <EOL> return "<STR_LIT>" <EOL> remote = executor . submit ( f ) . result ( ) <EOL> noneOrExceptionFuture = executor . exportS3Dataset ( remote , "<STR_LIT>" , "<STR_LIT:key>" ) <EOL> self . assertIs ( noneOrExceptionFuture . result ( ) , None ) <EOL> self . assertTrue ( s3 ( ) . getKeyValue ( "<STR_LIT>" , "<STR_LIT:key>" ) == "<STR_LIT>" ) <EOL> def test_execute_in_loop ( self ) : <EOL> fora = self . create_executor ( ) <EOL> def add ( x , y ) : <EOL> return x + y <EOL> with fora : <EOL> t0 = time . time ( ) <EOL> ct = <NUM_LIT:0> <EOL> while ct < <NUM_LIT:100> : <EOL> fora . submit ( add , <NUM_LIT:1> , <NUM_LIT:2> ) . result ( ) . toLocal ( ) . result ( ) <EOL> ct += <NUM_LIT:1> <EOL> self . assertTrue ( time . time ( ) - t0 < <NUM_LIT> ) <EOL> def test_slicing_operations_1 ( self ) : <EOL> a = "<STR_LIT>" <EOL> l = len ( a ) <EOL> with self . create_executor ( ) as fora : <EOL> results = [ ] <EOL> def f ( idx1 , idx2 ) : <EOL> try : <EOL> return ( "<STR_LIT:OK>" , a [ idx1 : idx2 ] ) <EOL> except : <EOL> return "<STR_LIT>" <EOL> for idx1 in range ( - l - <NUM_LIT:1> , l + <NUM_LIT:1> ) : <EOL> for idx2 in range ( - l - <NUM_LIT:1> , l + <NUM_LIT:1> ) : <EOL> results = results + [ f ( idx1 , idx2 ) ] <EOL> return results <EOL> self . equivalentEvaluationTest ( f ) <EOL> def test_slicing_operations_2 ( self ) : <EOL> a = "<STR_LIT>" <EOL> def f ( ) : <EOL> l = len ( a ) + <NUM_LIT:1> <EOL> def trySlice ( low , high , step ) : <EOL> try : <EOL> return ( "<STR_LIT:OK>" , a [ low : high : step ] ) <EOL> except : <EOL> return "<STR_LIT>" <EOL> result = [ ] <EOL> for idx1 in xrange ( - l , l ) : <EOL> for idx2 in xrange ( - l , l ) : <EOL> for idx3 in xrange ( - l , l ) : <EOL> if idx3 != <NUM_LIT:0> : <EOL> result = result + [ trySlice ( idx1 , idx2 , idx3 ) ] <EOL> return result <EOL> self . equivalentEvaluationTest ( f ) <EOL> def test_xrange ( self ) : <EOL> def f ( ) : <EOL> low = <NUM_LIT:0> <EOL> res = [ ] <EOL> for high in [ None ] + range ( - <NUM_LIT:7> , <NUM_LIT:7> ) : <EOL> for step in [ - <NUM_LIT:3> , - <NUM_LIT:2> , - <NUM_LIT:1> , None , <NUM_LIT:1> , <NUM_LIT:2> , <NUM_LIT:3> ] : <EOL> try : <EOL> if high is None : <EOL> res = res + [ range ( low ) ] <EOL> elif step is None : <EOL> res = res + [ range ( low , high ) ] <EOL> else : <EOL> res = res + [ range ( low , high , step ) ] <EOL> except Exception : <EOL> res = res + [ "<STR_LIT>" ] <EOL> self . equivalentEvaluationTest ( f ) <EOL> def test_types_and_combos ( self ) : <EOL> types = [ bool , str , int , type , object , list , tuple , dict ] <EOL> instances = [ <NUM_LIT:10> , "<STR_LIT>" , <NUM_LIT> , None , True , [ ] , ( ) , { } ] + types <EOL> callables = types + [ lambda x : x . __class__ ] <EOL> for c in callables : <EOL> for i in instances : <EOL> self . equivalentEvaluationTestThatHandlesExceptions ( <EOL> c , i , comparisonFunction = lambda x , y : x == y <EOL> ) <EOL> def test_exceptions_in_list_comprehensions_stable ( self ) : <EOL> def isPrime ( p ) : <EOL> if p == <NUM_LIT> : <EOL> raise UserWarning ( "<STR_LIT>" ) <EOL> x = <NUM_LIT:2> <EOL> while x * x <= p : <EOL> if p % x == <NUM_LIT:0> : <EOL> return <NUM_LIT:0> <EOL> x = x + <NUM_LIT:1> <EOL> return <NUM_LIT:1> <EOL> def f ( ct ) : <EOL> return sum ( [ isPrime ( x ) for x in xrange ( ct ) ] ) <EOL> def getATrace ( ct ) : <EOL> with self . create_executor ( ) as fora : <EOL> try : <EOL> c = fora . submit ( f , ct ) . result ( ) . toLocal ( ) . result ( ) <EOL> except Exception as e : <EOL> return e . trace <EOL> t1 = getATrace ( <NUM_LIT> ) <EOL> file_ = __file__ <EOL> if file_ [ - <NUM_LIT:4> : ] == "<STR_LIT>" : <EOL> file_ = __file__ [ : - <NUM_LIT:1> ] <EOL> for x in t1 : <EOL> self . assertEqual ( x [ '<STR_LIT:path>' ] [ <NUM_LIT:0> ] , os . path . abspath ( file_ ) ) <EOL> self . assertEqual ( t1 , getATrace ( <NUM_LIT> ) ) <EOL> self . assertEqual ( t1 , getATrace ( <NUM_LIT> ) ) <EOL> self . assertEqual ( t1 , getATrace ( <NUM_LIT> ) ) <EOL> def test_filtered_generator_expression ( self ) : <EOL> for ct in [ <NUM_LIT:0> , <NUM_LIT:1> , <NUM_LIT:2> , <NUM_LIT:4> , <NUM_LIT:8> , <NUM_LIT:16> , <NUM_LIT:32> , <NUM_LIT:64> , <NUM_LIT:100> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> ] : <EOL> self . equivalentEvaluationTest ( <EOL> lambda : sum ( x for x in xrange ( ct ) if x < ct / <NUM_LIT:2> ) ) <EOL> self . equivalentEvaluationTest ( <EOL> lambda : list ( x for x in xrange ( ct ) if x < ct / <NUM_LIT:2> ) ) <EOL> self . equivalentEvaluationTest ( <EOL> lambda : [ x for x in xrange ( ct ) if x < ct / <NUM_LIT:2> ] ) <EOL> def test_filtered_nested_expression ( self ) : <EOL> for ct in [ <NUM_LIT:0> , <NUM_LIT:1> , <NUM_LIT:2> , <NUM_LIT:4> , <NUM_LIT:8> , <NUM_LIT:16> , <NUM_LIT:32> , <NUM_LIT:64> ] : <EOL> self . equivalentEvaluationTest ( <EOL> lambda : sum ( ( outer * <NUM_LIT> + inner for outer in xrange ( ct ) for inner in xrange ( outer ) ) ) ) <EOL> self . equivalentEvaluationTest ( <EOL> lambda : sum ( ( outer * <NUM_LIT> + inner for outer in xrange ( ct ) if outer % <NUM_LIT:2> == <NUM_LIT:0> for inner in xrange ( outer ) ) ) ) <EOL> self . equivalentEvaluationTest ( <EOL> lambda : sum ( ( outer * <NUM_LIT> + inner for outer in xrange ( ct ) if outer % <NUM_LIT:2> == <NUM_LIT:0> for inner in xrange ( outer ) if inner % <NUM_LIT:2> == <NUM_LIT:0> ) ) ) <EOL> self . equivalentEvaluationTest ( <EOL> lambda : sum ( ( outer * <NUM_LIT> + inner for outer in xrange ( ct ) for inner in xrange ( outer ) if inner % <NUM_LIT:2> == <NUM_LIT:0> ) ) ) <EOL> def test_list_getitem_exhaustive_1 ( self ) : <EOL> sz = <NUM_LIT:3> <EOL> def f ( ) : <EOL> x = range ( sz ) <EOL> def trySlice ( start , stop , step ) : <EOL> try : <EOL> return ( "<STR_LIT:OK>" , x [ start : stop : step ] ) <EOL> except Exception as e : <EOL> if isinstance ( e , ValueError ) : <EOL> return "<STR_LIT>" <EOL> elif isinstance ( e , IndexError ) : <EOL> return "<STR_LIT>" <EOL> elif isinstance ( e , TypeError ) : <EOL> return "<STR_LIT>" <EOL> raise e <EOL> values = range ( - sz , sz ) + [ None , sz - <NUM_LIT:10> , sz + <NUM_LIT:10> ] <EOL> res = [ ] <EOL> for start in values : <EOL> for stop in values : <EOL> for step in values : <EOL> res = res + [ trySlice ( start , stop , step ) ] <EOL> self . equivalentEvaluationTest ( f ) <EOL> def test_list_getitem_exhaustive_2 ( self ) : <EOL> sz = <NUM_LIT:3> <EOL> def f ( ) : <EOL> x = range ( sz ) <EOL> def trySlice ( start , stop ) : <EOL> try : <EOL> return ( "<STR_LIT:OK>" , x [ start : stop ] ) <EOL> except Exception as e : <EOL> if isinstance ( e , ValueError ) : <EOL> return "<STR_LIT>" <EOL> elif isinstance ( e , IndexError ) : <EOL> return "<STR_LIT>" <EOL> elif isinstance ( e , TypeError ) : <EOL> return "<STR_LIT>" <EOL> raise e <EOL> values = range ( - sz , sz ) + [ None , sz - <NUM_LIT:10> , sz + <NUM_LIT:10> ] <EOL> res = [ ] <EOL> for start in values : <EOL> for stop in values : <EOL> res = res + [ trySlice ( start , stop ) ] <EOL> return res <EOL> self . equivalentEvaluationTest ( f ) <EOL> def test_list_getitem_exhaustive_3 ( self ) : <EOL> sz = <NUM_LIT:3> <EOL> def f ( ) : <EOL> x = range ( sz ) <EOL> def tryGetItem ( ix ) : <EOL> try : <EOL> return ( "<STR_LIT:OK>" , x [ ix ] ) <EOL> except Exception as e : <EOL> if isinstance ( e , ValueError ) : <EOL> return "<STR_LIT>" <EOL> elif isinstance ( e , IndexError ) : <EOL> return "<STR_LIT>" <EOL> elif isinstance ( e , TypeError ) : <EOL> return "<STR_LIT>" <EOL> raise e <EOL> indices = range ( - sz , sz ) + [ sz - <NUM_LIT:10> , sz + <NUM_LIT:10> , <NUM_LIT:1.0> , None ] <EOL> res = [ ] <EOL> for ix in indices : <EOL> res = res + [ tryGetItem ( ix ) ] <EOL> return res <EOL> self . equivalentEvaluationTest ( f ) <EOL> def test_tuple_getitem_exhaustive_1 ( self ) : <EOL> sz = <NUM_LIT:3> <EOL> def f ( ) : <EOL> x = tuple ( range ( sz ) ) <EOL> def tryGetItem ( ix ) : <EOL> try : <EOL> return ( "<STR_LIT:OK>" , x [ ix ] ) <EOL> except Exception as e : <EOL> return "<STR_LIT>" <EOL> if isinstance ( e , ValueError ) : <EOL> return "<STR_LIT>" <EOL> elif isinstance ( e , IndexError ) : <EOL> return "<STR_LIT>" <EOL> elif isinstance ( e , TypeError ) : <EOL> return "<STR_LIT>" <EOL> raise e <EOL> indices = range ( - sz , sz ) + [ sz - <NUM_LIT:10> , sz + <NUM_LIT:10> , <NUM_LIT:1.0> , None ] <EOL> res = [ ] <EOL> for ix in indices : <EOL> res = res + [ tryGetItem ( ix ) ] <EOL> return res <EOL> self . equivalentEvaluationTest ( f ) <EOL> def test_tuple_getitem_exhaustive_2 ( self ) : <EOL> sz = <NUM_LIT:3> <EOL> def f ( ) : <EOL> x = tuple ( range ( sz ) ) <EOL> def trySlice ( start , stop ) : <EOL> try : <EOL> return ( "<STR_LIT:OK>" , x [ start : stop ] ) <EOL> except Exception as e : <EOL> if isinstance ( e , ValueError ) : <EOL> return "<STR_LIT>" <EOL> elif isinstance ( e , IndexError ) : <EOL> return "<STR_LIT>" <EOL> elif isinstance ( e , TypeError ) : <EOL> return "<STR_LIT>" <EOL> raise e <EOL> values = range ( - sz , sz ) + [ None , sz - <NUM_LIT:10> , sz + <NUM_LIT:10> ] <EOL> res = [ ] <EOL> for start in values : <EOL> for stop in values : <EOL> res = res + [ trySlice ( start , stop ) ] <EOL> return res <EOL> self . equivalentEvaluationTest ( f ) <EOL> def test_string_getitem_exhaustive_1 ( self ) : <EOL> def f ( ) : <EOL> x = "<STR_LIT>" <EOL> def trySlice ( start , stop , step ) : <EOL> try : <EOL> return ( "<STR_LIT:OK>" , x [ start : stop : step ] ) <EOL> except Exception as e : <EOL> if isinstance ( e , ValueError ) : <EOL> return "<STR_LIT>" <EOL> elif isinstance ( e , IndexError ) : <EOL> return "<STR_LIT>" <EOL> elif isinstance ( e , TypeError ) : <EOL> return "<STR_LIT>" <EOL> raise e <EOL> sz = len ( x ) <EOL> values = range ( - sz , sz ) + [ None , sz - <NUM_LIT:10> , sz + <NUM_LIT:10> ] <EOL> res = [ ] <EOL> for start in values : <EOL> for stop in values : <EOL> for step in values : <EOL> res = res + [ trySlice ( start , stop , step ) ] <EOL> self . equivalentEvaluationTest ( f ) <EOL> def test_string_getitem_exhaustive_2 ( self ) : <EOL> def f ( ) : <EOL> x = "<STR_LIT>" <EOL> def trySlice ( start , stop ) : <EOL> try : <EOL> return ( "<STR_LIT:OK>" , x [ start : stop ] ) <EOL> except Exception as e : <EOL> if isinstance ( e , ValueError ) : <EOL> return "<STR_LIT>" <EOL> elif isinstance ( e , IndexError ) : <EOL> return "<STR_LIT>" <EOL> elif isinstance ( e , TypeError ) : <EOL> return "<STR_LIT>" <EOL> raise e <EOL> sz = len ( x ) <EOL> values = range ( - sz , sz ) + [ None , sz - <NUM_LIT:10> , sz + <NUM_LIT:10> ] <EOL> res = [ ] <EOL> for start in values : <EOL> for stop in values : <EOL> res = res + [ trySlice ( start , stop ) ] <EOL> return res <EOL> self . equivalentEvaluationTest ( f ) <EOL> def test_string_getitem_exhaustive_3 ( self ) : <EOL> def f ( ) : <EOL> x = "<STR_LIT>" <EOL> def tryGetItem ( ix ) : <EOL> try : <EOL> return ( "<STR_LIT:OK>" , x [ ix ] ) <EOL> except Exception as e : <EOL> if isinstance ( e , ValueError ) : <EOL> return "<STR_LIT>" <EOL> elif isinstance ( e , IndexError ) : <EOL> return "<STR_LIT>" <EOL> elif isinstance ( e , TypeError ) : <EOL> return "<STR_LIT>" <EOL> raise e <EOL> sz = len ( x ) <EOL> indices = range ( - sz , sz ) + [ sz - <NUM_LIT:10> , sz + <NUM_LIT:10> , <NUM_LIT:1.0> , None ] <EOL> res = [ ] <EOL> for ix in indices : <EOL> res = res + [ tryGetItem ( ix ) ] <EOL> return res <EOL> self . equivalentEvaluationTest ( f ) <EOL> def test_socket_io_disconnect ( self ) : <EOL> def f ( ) : <EOL> s = <NUM_LIT:0> <EOL> for i in xrange ( <NUM_LIT> ) : <EOL> s = s + ( ( i - <NUM_LIT:1> ) / ( i + <NUM_LIT:1> ) ) ** <NUM_LIT:2> <EOL> return s <EOL> with self . create_executor ( ) as executor : <EOL> future = executor . submit ( f ) <EOL> socketInterface = executor . connection . webObjectFactory . jsonInterface <EOL> socketInterface . disconnect ( ) <EOL> with self . assertRaises ( pyfora . PyforaError ) as cm : <EOL> future . result ( ) <EOL> error_content = cm . exception . message <EOL> self . assertEqual ( error_content [ '<STR_LIT>' ] , '<STR_LIT>' ) <EOL> self . assertEqual ( error_content [ '<STR_LIT:message>' ] , '<STR_LIT>' ) <EOL> def test_file_read ( self ) : <EOL> with self . create_executor ( ) as executor : <EOL> remote = executor . importRemoteFile ( '<STR_LIT>' ) . result ( ) <EOL> local = remote . toLocal ( ) . result ( ) <EOL> self . assertIn ( '<STR_LIT:127.0.0.1>' , local ) <EOL> def test_file_read_bad_path ( self ) : <EOL> with self . create_executor ( ) as executor : <EOL> with self . assertRaises ( pyfora . PyforaError ) : <EOL> executor . importRemoteFile ( '<STR_LIT>' ) . result ( ) </s>
