MCPcopy Index your code
hub / github.com/python/cpython / test_passing_values

Method test_passing_values

Lib/test/test_tcl.py:495–540  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

493 self.assertIsInstance(result, str)
494
495 def test_passing_values(self):
496 passValue = self.passValue
497
498 self.assertEqual(passValue(True), True if self.wantobjects else '1')
499 self.assertEqual(passValue(False), False if self.wantobjects else '0')
500 self.assertEqual(passValue('string'), 'string')
501 self.assertEqual(passValue('string\u20ac'), 'string\u20ac')
502 self.assertEqual(passValue('string\U0001f4bb'), 'string\U0001f4bb')
503 self.assertEqual(passValue('str\x00ing'), 'str\x00ing')
504 self.assertEqual(passValue('str\x00ing\xbd'), 'str\x00ing\xbd')
505 self.assertEqual(passValue('str\x00ing\u20ac'), 'str\x00ing\u20ac')
506 self.assertEqual(passValue('str\x00ing\U0001f4bb'),
507 'str\x00ing\U0001f4bb')
508 if sys.platform != 'win32':
509 self.assertEqual(passValue('<\udce2\udc82\udcac>'),
510 '<\u20ac>')
511 self.assertEqual(passValue('<\udced\udca0\udcbd\udced\udcb2\udcbb>'),
512 '<\U0001f4bb>')
513 self.assertEqual(passValue(b'str\x00ing'),
514 b'str\x00ing' if self.wantobjects else 'str\x00ing')
515 self.assertEqual(passValue(b'str\xc0\x80ing'),
516 b'str\xc0\x80ing' if self.wantobjects else 'str\xc0\x80ing')
517 self.assertEqual(passValue(b'str\xbding'),
518 b'str\xbding' if self.wantobjects else 'str\xbding')
519 for i in self.get_integers():
520 self.assertEqual(passValue(i), i if self.wantobjects else str(i))
521 for f in (0.0, 1.0, -1.0, 1/3,
522 sys.float_info.min, sys.float_info.max,
523 -sys.float_info.min, -sys.float_info.max):
524 if self.wantobjects:
525 self.assertEqual(passValue(f), f)
526 else:
527 self.assertEqual(float(passValue(f)), f)
528 if self.wantobjects:
529 f = passValue(float('nan'))
530 self.assertNotEqual(f, f)
531 self.assertEqual(passValue(float('inf')), float('inf'))
532 self.assertEqual(passValue(-float('inf')), -float('inf'))
533 else:
534 self.assertEqual(float(passValue(float('inf'))), float('inf'))
535 self.assertEqual(float(passValue(-float('inf'))), -float('inf'))
536 # XXX NaN representation can be not parsable by float()
537 self.assertEqual(passValue((1, '2', (3.4,))),
538 (1, '2', (3.4,)) if self.wantobjects else '1 2 3.4')
539 self.assertEqual(passValue(['a', ['b', 'c']]),
540 ('a', ('b', 'c')) if self.wantobjects else 'a {b c}')
541
542 def test_set_object_concurrent_mutation_in_sequence_conversion(self):
543 # Prevent SIGSEV when the object to convert is concurrently mutated.

Callers

nothing calls this directly

Calls 4

get_integersMethod · 0.95
strFunction · 0.85
assertNotEqualMethod · 0.80
assertEqualMethod · 0.45

Tested by

no test coverage detected