JL i LddlZddlZddlZddlmZddlmZdZdZ dZ dZ y)N)download) build_indexc\t|jd}td|}|dusJy)zSTest that download works properly when the parent folder of the download_dir exists another_dirmwa_ppdbTNstrjoinpathrtmp_path download_dirdownload_statuss d/mnt/ssd/data/python-lab/Trading/venv/lib/python3.12/site-packages/nltk/test/unit/test_downloader.py2test_downloader_using_existing_parent_download_dirr s3x((78Lz<8O d "" "c^t|jdd}td|}|dusJy)z[Test that download works properly when the parent folder of the download_dir does not existznon-existing-parent-folderzanother-non-existing-folderrTNrr s r6test_downloader_using_non_existing_parent_download_dirrs<68UVLz<8O d "" "rc hd}d}t|jd}t||dzD]}tjj d5}t d|}|dusJ||k(rhtjjdtjjdd z}|jdj|jk(sNJ||k(rGtjjd }|jdj|jk(sJd d d y #1swYxYw) zOTest that a second download correctly triggers the 'already up-to-date' messagertest_repeat_downloadzbuiltins.print stopwordsTzltk_data] Unzipping %s.corporaz stopwords.zipz6[nltk_data] Package stopwords is already up-to-date!N) r r rangeunittestmockpatchrcallospathjoincall_args_listargs)r first_downloadsecond_downloadr i print_mockrexpected_second_calls rtest_downloader_redownloadr(s6NOx(()?@AL >?Q#6 7V ]] !1 2 Vj&{LAO"d* **N"'/}}'9'91ggll9o>?($"00388Nzip) base_nameformatroot_dirbase_dirzhttps://someurl)rootbase_urlridchecksumsha256_checksum)r r rrr makedirsopenwriteshutil make_archivebasenamerdirnameget isinstancelen) r test_pkg_dir test_pkg_name test_pkg_path test_xml_pathfizip_path xml_indexpackage_element md5_checksumr8s rtest_build_indexrL4sx((45L"MGGLL-BMKK -GGLL=/0FGM mS ! R M?+   ww||Mm_>H !!-0   WW__\ *5FI l1oO   t $ 66 6"&&z2L lC (( ( | q  %))*;rQs) '##V2$r