@@ -223,3 +223,34 @@ def test_inequality_points(self):
223223 def test_inequality_points_diff_types (self ):
224224 c = CurveFp (100 , - 3 , 100 )
225225 self .assertNotEqual (self .g_23 , c )
226+
227+ def test_to_bytes_from_bytes (self ):
228+ p = Point (self .c_23 , 3 , 10 )
229+
230+ self .assertEqual (p , Point .from_bytes (self .c_23 , p .to_bytes ()))
231+
232+ def test_add_to_neg_self (self ):
233+ p = Point (self .c_23 , 3 , 10 )
234+
235+ self .assertEqual (INFINITY , p + (- p ))
236+
237+ def test_add_to_infinity (self ):
238+ p = Point (self .c_23 , 3 , 10 )
239+
240+ self .assertIs (p , p + INFINITY )
241+
242+ def test_mul_infinity_by_scalar (self ):
243+ self .assertIs (INFINITY , INFINITY * 10 )
244+
245+ def test_mul_by_negative (self ):
246+ p = Point (self .c_23 , 3 , 10 )
247+
248+ self .assertEqual (p * - 5 , (- p ) * 5 )
249+
250+ def test_str_infinity (self ):
251+ self .assertEqual (str (INFINITY ), "infinity" )
252+
253+ def test_str_point (self ):
254+ p = Point (self .c_23 , 3 , 10 )
255+
256+ self .assertEqual (str (p ), "(3,10)" )
0 commit comments