summaryrefslogtreecommitdiff
path: root/tests/test_api.py
diff options
context:
space:
mode:
authorGard Spreemann <gspr@nonempty.org>2020-11-20 08:48:13 +0100
committerGard Spreemann <gspr@nonempty.org>2020-11-20 08:48:13 +0100
commitc4a66d68b3bf98371d3de3328558d3e89f63db61 (patch)
treea6344a5cebdcf354aaa5dc8a89a28888ecba8080 /tests/test_api.py
parent4174479e682897af6d917831e2ca460d889536f7 (diff)
Upstream 0.4.0 tarball as released on PyPI.upstream/0.4.0upstream/latest-pypi
Diffstat (limited to 'tests/test_api.py')
-rw-r--r--tests/test_api.py25
1 files changed, 16 insertions, 9 deletions
diff --git a/tests/test_api.py b/tests/test_api.py
index 2403dca..c3f3766 100644
--- a/tests/test_api.py
+++ b/tests/test_api.py
@@ -1,13 +1,20 @@
+import cdsapi
+import os
-from __future__ import absolute_import, division, print_function, unicode_literals
+def test_request():
-from cdsapi import api
+ c = cdsapi.Client()
+ r = c.retrieve(
+ "reanalysis-era5-single-levels",
+ {
+ "variable": "2t",
+ "product_type": "reanalysis",
+ "date": "2012-12-01",
+ "time": "12:00"
+ },
+ )
-def test_bytes_to_string():
- assert api.bytes_to_string(1) == '1'
- assert api.bytes_to_string(1 << 10) == '1K'
- assert api.bytes_to_string(1 << 20) == '1M'
- assert api.bytes_to_string(1 << 30) == '1G'
- assert api.bytes_to_string(1 << 40) == '1T'
- assert api.bytes_to_string(1 << 50) == '1P'
+ r.download("test.grib")
+
+ assert os.path.getsize("test.grib") == 2076600