@@ -110,37 +110,36 @@ def test_contains():
110110    ]:
111111        assert  (x  in  y ) ==  expected 
112112
113- # TODO: Re-enable this if we ever add the ability to hash arbs. 
114- # def test_hash(): 
115- #     """`x` and `y` hash to the same value if they have the same midpoint and radius. 
116- 
117- #     Args: 
118- #         x: An arb. 
119- #         y: An arb. 
120- #         expected: Whether `x` and `y` should hash to the same value. 
121- #     """ 
122- #     def arb_pi(prec): 
123- #         """Helper to calculate arb to a given precision.""" 
124- #         with ctx.workprec(prec): 
125- #             return arb.pi() 
126- #     for x, y, expected in [ 
127- #         (arb(10), arb(10), True), 
128- #         (arb(10), arb(11), False), 
129- #         (arb(10.0), arb(10), True), 
130- #         ( 
131- #             arb(mid=10, rad=2), 
132- #             arb(mid=10, rad=2), 
133- #             True, 
134- #         ), 
135- #         ( 
136- #             arb(mid=10, rad=2), 
137- #             arb(mid=10, rad=3), 
138- #             False, 
139- #         ), 
140- #         (arb_pi(100), arb_pi(100), True), 
141- #         (arb_pi(100), arb_pi(1000), False), 
142- #     ]: 
143- #         assert (hash(x) == hash(y)) == expected 
113+ def  test_hash ():
114+     """`x` and `y` hash to the same value if they have the same midpoint and radius. 
115+ 
116+     Args: 
117+         x: An arb. 
118+         y: An arb. 
119+         expected: Whether `x` and `y` should hash to the same value. 
120+     """ 
121+     def  arb_pi (prec ):
122+         """Helper to calculate arb to a given precision.""" 
123+         with  ctx .workprec (prec ):
124+             return  arb .pi ()
125+     for  x , y , expected  in  [
126+         (arb (10 ), arb (10 ), True ),
127+         (arb (10 ), arb (11 ), False ),
128+         (arb (10.0 ), arb (10 ), True ),
129+         (
130+             arb (mid = 10 , rad = 2 ),
131+             arb (mid = 10 , rad = 2 ),
132+             True ,
133+         ),
134+         (
135+             arb (mid = 10 , rad = 2 ),
136+             arb (mid = 10 , rad = 3 ),
137+             False ,
138+         ),
139+         (arb_pi (100 ), arb_pi (100 ), True ),
140+         (arb_pi (100 ), arb_pi (1000 ), False ),
141+     ]:
142+         assert  (hash (x ) ==  hash (y )) ==  expected 
144143
145144
146145
@@ -338,8 +337,7 @@ def test_no_tests_missing():
338337    test_lower ,
339338    test_upper ,
340339    test_contains ,
341-     # TODO: Re-enable this if we ever add the ability to hash arbs. 
342-     # test_hash, 
340+     test_hash ,
343341    test_arb_sub ,
344342    test_arb_add ,
345343    test_arb_mul ,
0 commit comments