From f587518adb8d8b0c24ee04890c63f261c54803b8 Mon Sep 17 00:00:00 2001 From: Jim Paris Date: Mon, 26 Aug 2019 17:22:43 -0400 Subject: [PATCH] Improve test coverage --- nilmdb/client/httpclient.py | 2 +- tests/test_client.py | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/nilmdb/client/httpclient.py b/nilmdb/client/httpclient.py index 8aa789d..857121e 100644 --- a/nilmdb/client/httpclient.py +++ b/nilmdb/client/httpclient.py @@ -154,7 +154,7 @@ class HTTPClient(object): pending = tmp[-1] for line in lines: yield line - if pending is not None: # pragma: no cover (missing newline) + if pending is not None: yield pending # Yield the chunks or lines as requested diff --git a/tests/test_client.py b/tests/test_client.py index 9745c6c..9dbc861 100644 --- a/tests/test_client.py +++ b/tests/test_client.py @@ -100,6 +100,11 @@ class TestClient(object): with assert_raises(Error): client.http._handle_error(url, 600, json.dumps(args)) + # Use get_gen for an endpoint that doesn't have newlines, + # for better test coverage. + for line in client.http.get_gen("/version"): + pass + client.close() def test_client_02_createlist(self):