Lines Matching refs:long
29 special = map(long, [0, 1, 2, BASE, BASE >> 1])
82 class LongSubclass(long):
85 class OtherLongSubclass(long):
90 ntype = long
314 self.assertEqual(long(got, 0), x, Frm('long("%s", 0) != %r', got, x))
332 self.assertEqual(long(314), 314L)
333 self.assertEqual(long(3.14), 3L)
334 self.assertEqual(long(314L), 314L)
336 self.assertEqual(type(long(314)), long)
337 self.assertEqual(type(long(3.14)), long)
338 self.assertEqual(type(long(314L)), long)
340 self.assertEqual(long(-3.14), -3L)
341 self.assertEqual(long(3.9), 3L)
342 self.assertEqual(long(-3.9), -3L)
343 self.assertEqual(long(3.5), 3L)
344 self.assertEqual(long(-3.5), -3L)
345 self.assertEqual(long("-3"), -3L)
346 self.assertEqual(long("0b10", 2), 2L)
347 self.assertEqual(long("0o10", 8), 8L)
348 self.assertEqual(long("0x10", 16), 16L)
350 self.assertEqual(long(unicode("-3")), -3L)
352 self.assertEqual(long("10",16), 16L)
354 self.assertEqual(long(unicode("10"),16), 16L)
374 self.assertEqual(long(ss), long(vv))
378 self.assertRaises(ValueError, long, '123\0')
379 self.assertRaises(ValueError, long, '53', 40)
380 self.assertRaises(TypeError, long, 1, 12)
383 self.assertEqual(long(' 0123 ', 0), 83)
384 self.assertEqual(long(' 0123 ', 0), 83)
385 self.assertEqual(long('000', 0), 0)
386 self.assertEqual(long('0o123', 0), 83)
387 self.assertEqual(long('0x123', 0), 291)
388 self.assertEqual(long('0b100', 0), 4)
389 self.assertEqual(long(' 0O123 ', 0), 83)
390 self.assertEqual(long(' 0X123 ', 0), 291)
391 self.assertEqual(long(' 0B100 ', 0), 4)
392 self.assertEqual(long('0', 0), 0)
393 self.assertEqual(long('+0', 0), 0)
394 self.assertEqual(long('-0', 0), 0)
395 self.assertEqual(long('00', 0), 0)
396 self.assertRaises(ValueError, long, '08', 0)
397 self.assertRaises(ValueError, long, '-012395', 0)
401 self.assertRaises(ValueError, long, '123\0', 10)
402 self.assertRaises(ValueError, long, '123\x00 245', 20)
404 self.assertEqual(long('100000000000000000000000000000000', 2),
406 self.assertEqual(long('102002022201221111211', 3), 4294967296)
407 self.assertEqual(long('10000000000000000', 4), 4294967296)
408 self.assertEqual(long('32244002423141', 5), 4294967296)
409 self.assertEqual(long('1550104015504', 6), 4294967296)
410 self.assertEqual(long('211301422354', 7), 4294967296)
411 self.assertEqual(long('40000000000', 8), 4294967296)
412 self.assertEqual(long('12068657454', 9), 4294967296)
413 self.assertEqual(long('4294967296', 10), 4294967296)
414 self.assertEqual(long('1904440554', 11), 4294967296)
415 self.assertEqual(long('9ba461594', 12), 4294967296)
416 self.assertEqual(long('535a79889', 13), 4294967296)
417 self.assertEqual(long('2ca5b7464', 14), 4294967296)
418 self.assertEqual(long('1a20dcd81', 15), 4294967296)
419 self.assertEqual(long('100000000', 16), 4294967296)
420 self.assertEqual(long('a7ffda91', 17), 4294967296)
421 self.assertEqual(long('704he7g4', 18), 4294967296)
422 self.assertEqual(long('4f5aff66', 19), 4294967296)
423 self.assertEqual(long('3723ai4g', 20), 4294967296)
424 self.assertEqual(long('281d55i4', 21), 4294967296)
425 self.assertEqual(long('1fj8b184', 22), 4294967296)
426 self.assertEqual(long('1606k7ic', 23), 4294967296)
427 self.assertEqual(long('mb994ag', 24), 4294967296)
428 self.assertEqual(long('hek2mgl', 25), 4294967296)
429 self.assertEqual(long('dnchbnm', 26), 4294967296)
430 self.assertEqual(long('b28jpdm', 27), 4294967296)
431 self.assertEqual(long('8pfgih4', 28), 4294967296)
432 self.assertEqual(long('76beigg', 29), 4294967296)
433 self.assertEqual(long('5qmcpqg', 30), 4294967296)
434 self.assertEqual(long('4q0jto4', 31), 4294967296)
435 self.assertEqual(long('4000000', 32), 4294967296)
436 self.assertEqual(long('3aokq94', 33), 4294967296)
437 self.assertEqual(long('2qhxjli', 34), 4294967296)
438 self.assertEqual(long('2br45qb', 35), 4294967296)
439 self.assertEqual(long('1z141z4', 36), 4294967296)
441 self.assertEqual(long('100000000000000000000000000000001', 2),
443 self.assertEqual(long('102002022201221111212', 3), 4294967297)
444 self.assertEqual(long('10000000000000001', 4), 4294967297)
445 self.assertEqual(long('32244002423142', 5), 4294967297)
446 self.assertEqual(long('1550104015505', 6), 4294967297)
447 self.assertEqual(long('211301422355', 7), 4294967297)
448 self.assertEqual(long('40000000001', 8), 4294967297)
449 self.assertEqual(long('12068657455', 9), 4294967297)
450 self.assertEqual(long('4294967297', 10), 4294967297)
451 self.assertEqual(long('1904440555', 11), 4294967297)
452 self.assertEqual(long('9ba461595', 12), 4294967297)
453 self.assertEqual(long('535a7988a', 13), 4294967297)
454 self.assertEqual(long('2ca5b7465', 14), 4294967297)
455 self.assertEqual(long('1a20dcd82', 15), 4294967297)
456 self.assertEqual(long('100000001', 16), 4294967297)
457 self.assertEqual(long('a7ffda92', 17), 4294967297)
458 self.assertEqual(long('704he7g5', 18), 4294967297)
459 self.assertEqual(long('4f5aff67', 19), 4294967297)
460 self.assertEqual(long('3723ai4h', 20), 4294967297)
461 self.assertEqual(long('281d55i5', 21), 4294967297)
462 self.assertEqual(long('1fj8b185', 22), 4294967297)
463 self.assertEqual(long('1606k7id', 23), 4294967297)
464 self.assertEqual(long('mb994ah', 24), 4294967297)
465 self.assertEqual(long('hek2mgm', 25), 4294967297)
466 self.assertEqual(long('dnchbnn', 26), 4294967297)
467 self.assertEqual(long('b28jpdn', 27), 4294967297)
468 self.assertEqual(long('8pfgih5', 28), 4294967297)
469 self.assertEqual(long('76beigh', 29), 4294967297)
470 self.assertEqual(long('5qmcpqh', 30), 4294967297)
471 self.assertEqual(long('4q0jto5', 31), 4294967297)
472 self.assertEqual(long('4000001', 32), 4294967297)
473 self.assertEqual(long('3aokq95', 33), 4294967297)
474 self.assertEqual(long('2qhxjlj', 34), 4294967297)
475 self.assertEqual(long('2br45qc', 35), 4294967297)
476 self.assertEqual(long('1z141z5', 36), 4294967297)
483 self.assertRaises(AttributeError, long, ClassicMissingMethods())
487 self.assertRaises(TypeError, long, MissingMethods())
497 class Foo2(long):
501 class Foo3(long):
505 class Foo4(long):
509 class Foo5(long):
513 self.assertEqual(long(Foo0()), 42L)
514 self.assertEqual(long(Foo1()), 42L)
515 self.assertEqual(long(Foo2()), 42L)
516 self.assertEqual(long(Foo3()), 0)
517 self.assertEqual(long(Foo4()), 42)
518 self.assertRaises(TypeError, long, Foo5())
528 self.assertEqual(long(LongOverridesTrunc()), 42)
533 self.assertEqual(long(JustTrunc()), 42)
543 self.assertEqual(long(TruncReturnsNonLong()), 42)
554 long(TruncReturnsNonIntegral())
567 n = long(good_int)
579 hugepos_aslong = long(hugepos)
580 hugeneg_aslong = long(hugeneg)
608 self.assertIsInstance(y, long,
616 self.assertIsInstance(y, long,
619 class long2(long):
623 self.assertIs(type(y), long,
646 class MyLong(long):
650 self.assertIsInstance(x, long)
668 longx = long(x)
675 longy = long(y)
711 expected = pow(longx, longy, long(z))
715 self.assertRaises(TypeError, pow,longx, longy, long(z))
726 long(2**53-3),
727 long(2**53-2),
728 long(2**53-1),
729 long(2**53),
730 long(2**53+2),
731 long(2**54-4),
732 long(2**54-2),
733 long(2**54),
734 long(2**54+4)]
736 self.assertEqual(long(float(x)), x)
737 self.assertEqual(long(float(-x)), -x)
742 self.assertEqual(long(float(2L**p*(2**53+x))), 2L**p*(2**53+y))
748 self.assertEqual(long(float(2L**p*(2**54+x))), 2L**p*(2**54+y))
751 long_dbl_max = long(DBL_MAX)
768 x = long(2**p * (2**53 + 1) + 1)
769 y = long(2**p * (2**53+ 2))
770 self.assertEqual(long(float(x)), y)
772 x = long(2**p * (2**53 + 1))
773 y = long(2**p * 2**53)
774 self.assertEqual(long(float(x)), y)
778 self.assertEqual(float(long(x)), x)
833 if isinstance(value, (int, long)):
882 long(t-1), long(t), long(t+1)])
886 t = long(1e200)
904 self.assertRaises(OverflowError, long, float('inf'))
905 self.assertRaises(OverflowError, long, float('-inf'))
906 self.assertRaises(ValueError, long, float('nan'))
911 x = long(x)