def test_divmod():
 (x, y) = fscalars('xy')
 (d, r) = divmod(x, y)
 fn = gof.DualLinker().accept(gof.FunctionGraph([x, y], [d, r])).make_function()
 for (a, b) in ((0, 1), (1, 1), (0, (-1)), (1, (-1)), ((-1), (-1)), (1, 2), ((-1), 2), (1, (-2)), ((-1), (-2)), (5, 3), ((-5), 3), (5, (-3)), ((-5), (-3))):
  (d_v, r_v) = fn(a, b)
  (d_vp, r_vp) = divmod(a, b)
  assert ((d_v == d_vp) and (r_v == r_vp)), (a,)

def test_divmod ( ) : ( x , y ) = fscalars ( 'xy' ) ( d , r ) = divmod ( x , y ) fn = gof . DualLinker ( ) . accept ( gof . FunctionGraph ( [ x , y ] , [ d , r ] ) ) . make_function ( ) for ( a , b ) in ( ( 0 , 1 ) , ( 1 , 1 ) , ( 0 , ( - 1 ) ) , ( 1 , ( - 1 ) ) , ( ( - 1 ) , ( - 1 ) ) , ( 1 , 2 ) , ( ( - 1 ) , 2 ) , ( 1 , ( - 2 ) ) , ( ( - 1 ) , ( - 2 ) ) , ( 5 , 3 ) , ( ( - 5 ) , 3 ) , ( 5 , ( - 3 ) ) , ( ( - 5 ) , ( - 3 ) ) ) : ( d_v , r_v ) = fn ( a , b ) ( d_vp , r_vp ) = divmod ( a , b ) assert ( ( d_v == d_vp ) and ( r_v == r_vp ) ) , ( a , )
confirm that divmod is equivalent to the python version .