Browse Source

Fix and test stream_count

tags/nilmdb-1.1^2
Jim Paris 11 years ago
parent
commit
ca5253ddee
2 changed files with 5 additions and 1 deletions
  1. +2
    -1
      nilmdb/client/client.py
  2. +3
    -0
      tests/test_client.py

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

@@ -184,7 +184,8 @@ class Client(object):
Return the number of rows of data in the stream that satisfy
the given timestamps.
"""
return int(self.stream_extract(path, start, end, count = True)[0])
counts = list(self.stream_extract(path, start, end, count = True))
return int(counts[0])

class StreamInserter(object):
"""Object returned by stream_insert_context() that manages


+ 3
- 0
tests/test_client.py View File

@@ -251,6 +251,9 @@ class TestClient(object):
x = client.stream_intervals("/newton/prep")
in_("nesting calls is not supported", str(e.exception))

# Test count
eq_(client.stream_count("/newton/prep"), 14400)

client.close()

def test_client_06_generators(self):


Loading…
Cancel
Save