Browse Source

Test previously untested code

tags/nilmdb-2.0.0
Jim Paris 4 years ago
parent
commit
8b4acf41d6
2 changed files with 7 additions and 1 deletions
  1. +1
    -1
      nilmdb/client/client.py
  2. +6
    -0
      tests/test_client.py

+ 1
- 1
nilmdb/client/client.py View File

@@ -331,7 +331,7 @@ class StreamInserter(object):
# Send the block once we have enough data
if self._block_len >= maxdata:
self._send_block(final = False)
if self._block_len >= self._max_data_after_send: # pragma: no cover
if self._block_len >= self._max_data_after_send:
raise ValueError("too much data left over after trying"
" to send intermediate block; is it"
" missing newlines or malformed?")


+ 6
- 0
tests/test_client.py View File

@@ -571,6 +571,12 @@ class TestClient(object):
ctx.finalize()
ctx.insert(b"# this is super long" * 100)

# override _max_data_after_send to trigger ValueError on a
# long nonterminated line
ctx._max_data_after_send = 1000
with assert_raises(ValueError):
ctx.insert(b"# this is super long" * 100)

with assert_raises(ClientError):
with client.stream_insert_context("/context/test",
1000, 2000) as ctx:


Loading…
Cancel
Save