コード例 #1
0
ファイル: test_download.py プロジェクト: GalLellouche/cornac
def test_download_normal_file():
    fpath = cache(url='https://static.preferred.ai/cornac/hello_world.txt')
    assert os.path.exists(fpath)
    with open(fpath, 'r') as f:
        assert "I'm Cornac!" == f.read().strip()

    cache(url='https://static.preferred.ai/cornac/hello_world.txt')
コード例 #2
0
    def test_download_normal_file(self):
        fpath = cache(
            url='https://static.preferred.ai/cornac/tests/hello_world.txt')
        self.assertTrue(os.path.exists(fpath))
        with open(fpath, 'r') as f:
            self.assertEqual("I'm Cornac!", f.read().strip())

        cache(url='https://static.preferred.ai/cornac/tests/hello_world.txt')
コード例 #3
0
 def test_download_zip_file(self):
     fpath = cache(url='https://static.preferred.ai/cornac/tests/dummy.zip',
                   unzip=True,
                   relative_path='dummy/hello_world.txt')
     self.assertTrue(os.path.exists(fpath))
     with open(fpath, 'r') as f:
         self.assertEqual("I'm Cornac!", f.read().strip())
コード例 #4
0
ファイル: test_download.py プロジェクト: GalLellouche/cornac
def test_download_zip_file():
    fpath = cache(url='https://static.preferred.ai/cornac/dummy.zip',
                  unzip=True,
                  relative_path='dummy/hello_world.txt')
    assert os.path.exists(fpath)
    with open(fpath, 'r') as f:
        assert "I'm Cornac!" == f.read().strip()
コード例 #5
0
 def test_download_bzip2_file(self):
     fpath = cache(
         url='https://static.preferred.ai/cornac/tests/dummy.tar.bz2',
         unzip=True,
         relative_path='dummy/bz2.txt')
     self.assertTrue(os.path.exists(fpath))
     with open(fpath, 'r') as f:
         self.assertEqual('bz2', f.read().strip())