a zeR @sdZddlmZddlmZmZddlZddlZddlZGdddej Z Gdddej Z e d kre ejd kreejd edS) aT These tests are meant to exercise that requests to create objects bigger than what the address space allows are properly met with an OverflowError (rather than crash weirdly). Primarily, this means 32-bit builds with at least 2 GiB of available memory. You need to pass the -M option to regrtest (e.g. "-M 2.1G") for tests to be enabled. )support)bigaddrspacetestMAX_Py_ssize_tNc@s0eZdZeddZeddZeddZdS) BytesTestcCs2z&dtd}|ttj|dWd}nd}0dSNxsxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx)r assertRaises OverflowErroroperatoraddselfxrJ/opt/bitninja-python-dojo/embedded/lib/python3.9/test/test_bigaddrspace.py test_concats zBytesTest.test_concatcCszxdtd}|t}|d}Wdn1s60Y|t}|d7}Wdn1sh0YWd}nd}0dSr)rr r rrcmrrrtest_optimized_concat s  & (zBytesTest.test_optimized_concatcCs2z&dtd}|ttj|dWd}nd}0dS)Nrr)rr r r mulr rrr test_repeat/s zBytesTest.test_repeatN)__name__ __module__ __qualname__rrrrrrrrrs   rc@s4eZdZdZeddZeddZeddZdS) StrTestcCs<z0dttd|j}|ttj||Wd}nd}0dSNr皙?)intr unicodesizer MemoryErrorr r r rrrr<szStrTest.test_concatcCszdttd|j}|t}||}Wdn1s@0Y|t}||7}Wdn1sr0YWd}nd}0dSr)rrr r r!rrrrrGs & (zStrTest.test_optimized_concatcCs<z0dttd|j}|ttj|dWd}nd}0dS)Nrr)rrr r r!r rr rrrrVszStrTest.test_repeatN)rrrr rrrrrrrrr8s  r__main__)__doc__testrZ test.supportrrZunittestr sysZTestCaserrrlenargvZ set_memlimitmainrrrrs %'