a zej@sddlZddlmZddlZddlZddlZddlmZdZdZ e Z Gdddej Z Gdd d ejZed kr|edS) N) start_threads) print_exc2c@seZdZdZdZddZdS)TempFileGreedyrcCspt|_tttD]P}ztd}| Wn&|j d7_ t |jdYq0|j d7_ qdS)Nzw+b)file) ioStringIOerrors startEventwaitrangeFILES_PER_THREADtempfile TemporaryFileclose error_countrok_count)selfifrN/opt/bitninja-python-dojo/embedded/lib/python3.9/test/test_threadedtempfile.pyrun$s    zTempFileGreedy.runN)__name__ __module__ __qualname__rrrrrrrr src@seZdZddZdS)ThreadedTempFileTestcCsddttD}t|tjWdn1s40Ytdd|D}dd|D}dt||d|f}||g|||tt dS)NcSsg|] }tqSr)r).0rrrr 4z2ThreadedTempFileTest.test_main..css|] }|jVqdS)N)rrtrrr 7r!z1ThreadedTempFileTest.test_main..cSs*g|]"}|jrt|jt|jqSr)rstrnamer getvaluer"rrrr 8szErrors: errors %d ok %d %s ) r NUM_THREADSrr setsumlenjoinZ assertEqualr)rthreadsokr msgrrr test_main3s zThreadedTempFileTest.test_mainN)rrrr1rrrrr2sr__main__)rZ test.supportrZunittestr threading tracebackrr)rEventr ThreadrZTestCaserrmainrrrrs