1+ import sys
12import unittest
23import test .support
34from ctypes import (CDLL , PyDLL , ArgumentError ,
@@ -224,6 +225,8 @@ def __dict__(self):
224225 with self .assertRaises (ZeroDivisionError ):
225226 WorseStruct ().__setstate__ ({}, b'foo' )
226227
228+ @unittest .skipUnless (sys .float_repr_style == 'short' ,
229+ "applies only when using short float repr style" )
227230 def test_parameter_repr (self ):
228231 self .assertRegex (repr (c_bool .from_param (True )), r"^<cparam '\?' at 0x[A-Fa-f0-9]+>$" )
229232 self .assertEqual (repr (c_char .from_param (97 )), "<cparam 'c' ('a')>" )
@@ -240,6 +243,7 @@ def test_parameter_repr(self):
240243 self .assertRegex (repr (c_ulonglong .from_param (20000 )), r"^<cparam '[LIQ]' \(20000\)>$" )
241244 self .assertEqual (repr (c_float .from_param (1.5 )), "<cparam 'f' (1.5)>" )
242245 self .assertEqual (repr (c_double .from_param (1.5 )), "<cparam 'd' (1.5)>" )
246+ self .assertEqual (repr (c_double .from_param (1e300 )), "<cparam 'd' (1e+300)>" )
243247 self .assertRegex (repr (c_longdouble .from_param (1.5 )), r"^<cparam ('d' \(1.5\)|'g' at 0x[A-Fa-f0-9]+)>$" )
244248 self .assertRegex (repr (c_char_p .from_param (b'hihi' )), r"^<cparam 'z' \(0x[A-Fa-f0-9]+\)>$" )
245249 self .assertRegex (repr (c_wchar_p .from_param ('hihi' )), r"^<cparam 'Z' \(0x[A-Fa-f0-9]+\)>$" )
0 commit comments