def test_load_data_from_storage(): SCHEMA = { 'fields': [{'format': 'default', 'name': 'id', 'type': 'integer'}], 'missingValues': [''] } storage = Mock( buckets=['data'], describe=lambda bucket: {'fields': [{'name': 'id', 'type': 'integer'}]}, iter=lambda bucket: [[1], [2], [3]], spec=Storage) resource = Resource({'path': 'data'}, storage=storage) resource.infer() assert resource.descriptor == { 'name': 'data', 'path': 'data', 'encoding': 'utf-8', 'profile': 'tabular-data-resource', 'schema': SCHEMA} assert resource.headers == ['id'] assert resource.read() == [[1], [2], [3]]
def test_read_integrity_size(): descriptor = deepcopy(DESCRIPTOR) descriptor['hash'] = None resource = Resource(descriptor) resource.read(integrity=True) assert True
def test_read_integrity(): descriptor = deepcopy(DESCRIPTOR) resource = Resource(descriptor) resource.read(integrity=True) assert True