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

Method test_parse_memlimit

Lib/test/test_support.py:720–735  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

718 self.fail("RecursionError was not raised")
719
720 def test_parse_memlimit(self):
721 parse = support._parse_memlimit
722 KiB = 1024
723 MiB = KiB * 1024
724 GiB = MiB * 1024
725 TiB = GiB * 1024
726 self.assertEqual(parse('0k'), 0)
727 self.assertEqual(parse('3k'), 3 * KiB)
728 self.assertEqual(parse('2.4m'), int(2.4 * MiB))
729 self.assertEqual(parse('4g'), int(4 * GiB))
730 self.assertEqual(parse('1t'), TiB)
731
732 for limit in ('', '3', '3.5.10k', '10x'):
733 with self.subTest(limit=limit):
734 with self.assertRaises(ValueError):
735 parse(limit)
736
737 def test_set_memlimit(self):
738 _4GiB = 4 * 1024 ** 3

Callers

nothing calls this directly

Calls 4

parseFunction · 0.50
assertEqualMethod · 0.45
subTestMethod · 0.45
assertRaisesMethod · 0.45

Tested by

no test coverage detected