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

Method test_parse_memlimit

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

Source from the content-addressed store, hash-verified

699 self.fail("RecursionError was not raised")
700
701 def test_parse_memlimit(self):
702 parse = support._parse_memlimit
703 KiB = 1024
704 MiB = KiB * 1024
705 GiB = MiB * 1024
706 TiB = GiB * 1024
707 self.assertEqual(parse('0k'), 0)
708 self.assertEqual(parse('3k'), 3 * KiB)
709 self.assertEqual(parse('2.4m'), int(2.4 * MiB))
710 self.assertEqual(parse('4g'), int(4 * GiB))
711 self.assertEqual(parse('1t'), TiB)
712
713 for limit in ('', '3', '3.5.10k', '10x'):
714 with self.subTest(limit=limit):
715 with self.assertRaises(ValueError):
716 parse(limit)
717
718 def test_set_memlimit(self):
719 _4GiB = 4 * 1024 ** 3

Callers

nothing calls this directly

Calls 4

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

Tested by

no test coverage detected