MCPcopy Index your code
hub / github.com/RustPython/RustPython / test_from_hex

Method test_from_hex

Lib/test/test_float.py:1268–1565  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

1266
1267 @unittest.expectedFailure # TODO: RUSTPYTHON; ValueError: invalid hexadecimal floating-point string
1268 def test_from_hex(self):
1269 MIN = self.MIN
1270 MAX = self.MAX
1271 TINY = self.TINY
1272 EPS = self.EPS
1273
1274 # two spellings of infinity, with optional signs; case-insensitive
1275 self.identical(fromHex('inf'), INF)
1276 self.identical(fromHex('+Inf'), INF)
1277 self.identical(fromHex('-INF'), -INF)
1278 self.identical(fromHex('iNf'), INF)
1279 self.identical(fromHex('Infinity'), INF)
1280 self.identical(fromHex('+INFINITY'), INF)
1281 self.identical(fromHex('-infinity'), -INF)
1282 self.identical(fromHex('-iNFiNitY'), -INF)
1283
1284 # nans with optional sign; case insensitive
1285 self.identical(fromHex('nan'), NAN)
1286 self.identical(fromHex('+NaN'), NAN)
1287 self.identical(fromHex('-NaN'), NAN)
1288 self.identical(fromHex('-nAN'), NAN)
1289
1290 # variations in input format
1291 self.identical(fromHex('1'), 1.0)
1292 self.identical(fromHex('+1'), 1.0)
1293 self.identical(fromHex('1.'), 1.0)
1294 self.identical(fromHex('1.0'), 1.0)
1295 self.identical(fromHex('1.0p0'), 1.0)
1296 self.identical(fromHex('01'), 1.0)
1297 self.identical(fromHex('01.'), 1.0)
1298 self.identical(fromHex('0x1'), 1.0)
1299 self.identical(fromHex('0x1.'), 1.0)
1300 self.identical(fromHex('0x1.0'), 1.0)
1301 self.identical(fromHex('+0x1.0'), 1.0)
1302 self.identical(fromHex('0x1p0'), 1.0)
1303 self.identical(fromHex('0X1p0'), 1.0)
1304 self.identical(fromHex('0X1P0'), 1.0)
1305 self.identical(fromHex('0x1P0'), 1.0)
1306 self.identical(fromHex('0x1.p0'), 1.0)
1307 self.identical(fromHex('0x1.0p0'), 1.0)
1308 self.identical(fromHex('0x.1p4'), 1.0)
1309 self.identical(fromHex('0x.1p04'), 1.0)
1310 self.identical(fromHex('0x.1p004'), 1.0)
1311 self.identical(fromHex('0x1p+0'), 1.0)
1312 self.identical(fromHex('0x1P-0'), 1.0)
1313 self.identical(fromHex('+0x1p0'), 1.0)
1314 self.identical(fromHex('0x01p0'), 1.0)
1315 self.identical(fromHex('0x1p00'), 1.0)
1316 self.identical(fromHex(' 0x1p0 '), 1.0)
1317 self.identical(fromHex('\n 0x1p0'), 1.0)
1318 self.identical(fromHex('0x1p0 \t'), 1.0)
1319 self.identical(fromHex('0xap0'), 10.0)
1320 self.identical(fromHex('0xAp0'), 10.0)
1321 self.identical(fromHex('0xaP0'), 10.0)
1322 self.identical(fromHex('0xAP0'), 10.0)
1323 self.identical(fromHex('0xbep0'), 190.0)
1324 self.identical(fromHex('0xBep0'), 190.0)
1325 self.identical(fromHex('0xbEp0'), 190.0)

Callers

nothing calls this directly

Calls 2

identicalMethod · 0.95
assertRaisesMethod · 0.45

Tested by

no test coverage detected