Example #1
0
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')
Example #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')
Example #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())
Example #4
0
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()
Example #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())