Skip to content

Commit

Permalink
Fixed RemoteLoader
Browse files Browse the repository at this point in the history
  • Loading branch information
roll committed Oct 7, 2020
1 parent ca3c599 commit 180f1be
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 3 deletions.
4 changes: 3 additions & 1 deletion frictionless/loaders/remote.py
Expand Up @@ -66,10 +66,12 @@ def flush(self):
pass

def read(self, size=-1):
if size == -1:
size = None
return self.__response.raw.read(size)

def read1(self, size=-1):
return self.__response.raw.read(size)
return self.read(size)

def seek(self, offset, whence=0):
assert offset == 0
Expand Down
16 changes: 14 additions & 2 deletions tests/loaders/test_remote.py
@@ -1,7 +1,7 @@
import pytest
from frictionless import Table

BASE_URL = "https://raw.githubusercontent.com/frictionlessdata/tabulator-py/master/%s"
BASE_URL = "https://raw.githubusercontent.com/frictionlessdata/frictionless-py/master/%s"


# Read
Expand All @@ -17,5 +17,17 @@ def test_table_https():
@pytest.mark.ci
def test_table_https_latin1():
# Github returns wrong encoding `utf-8`
with Table(BASE_URL % "data/special/latin1.csv") as table:
with Table(BASE_URL % "data/latin1.csv") as table:
assert table.read_data()


@pytest.mark.ci
def test_table_https_big_file():
with Table(BASE_URL % "data/table1.csv") as table:
assert table.read_rows()
assert table.stats == {
"hash": "78ea269458be04a0e02816c56fc684ef",
"bytes": 1000000,
"fields": 10,
"rows": 10000,
}

0 comments on commit 180f1be

Please sign in to comment.