def test_gz(self) : fLOG (__file__, self._testMethodName, OutputPrint = __name__ == "__main__") fold = os.path.join(os.path.abspath(os.path.split(__file__)[0]), "temp_stand") if not os.path.exists(fold): os.mkdir(fold) for f in os.listdir(fold): if os.path.isfile(f): os.remove(os.path.join(fold,f)) files = download_data("facebook_combined.txt.gz",website="http://snap.stanford.edu/data/", fLOG = fLOG, whereTo = fold) fLOG(files)
def test_tar_gz(self) : fLOG (__file__, self._testMethodName, OutputPrint = __name__ == "__main__") fold = os.path.join(os.path.abspath(os.path.split(__file__)[0]), "temp_stand") if not os.path.exists(fold): os.mkdir(fold) for f in os.listdir(fold): if os.path.isfile(f): os.remove(os.path.join(fold,f)) files = download_data("facebook.tar.gz",website="http://snap.stanford.edu/data/", fLOG = fLOG, whereTo = fold) fLOG(files) sh = [ g for g in files if g.endswith("3980.egofeat") ] assert len(files)>0 assert len(sh)==1
def test_import_one(self) : fLOG (__file__, self._testMethodName, OutputPrint = __name__ == "__main__") fold = os.path.join(os.path.abspath(os.path.split(__file__)[0]), "temp_http") if not os.path.exists(fold): os.mkdir(fold) exp = ["VOEUX01.txt", "voeux.zip"] for f in exp : g = os.path.join(fold, f) if os.path.exists(g): os.remove(g) one = "voeux.zip" res = download_data(one, website = "xd", whereTo = fold, fLOG = fLOG) fLOG(len(res),res) assert len(res) == 14 assert "VOEUX01.txt" in res[0] for f in exp : g = os.path.join(fold, f) assert os.path.exists(g)