diff --git a/tests/test_bulkdata.py b/tests/test_bulkdata.py index 8021836..48babf8 100644 --- a/tests/test_bulkdata.py +++ b/tests/test_bulkdata.py @@ -60,7 +60,7 @@ class TestBulkData(object): with assert_raises(IndexError): x = get_node_slice(0) with assert_raises(IndexError): - x = node[0] + x = node[0] # timestamp raw = [] for i in range(1000): raw.append("%d 1 2 3 4 5 6 7 8\n" % (10000 + i)) diff --git a/tests/test_client.py b/tests/test_client.py index d40ffbd..4a15036 100644 --- a/tests/test_client.py +++ b/tests/test_client.py @@ -639,23 +639,26 @@ class TestClient(object): eq_(connections(), (1, 6)) def test_client_13_timestamp_rounding(self): - raise SkipTest("doesn't work right") - - # Test potentially bad timestamps (due to floating point roundoff etc) + # Test potentially bad timestamps (due to floating point + # roundoff etc). The server will round floating point values + # to the nearest int. client = nilmdb.client.Client(testurl) client.stream_create("/rounding/test", "uint16_1") with client.stream_insert_context("/rounding/test", - 100000000, 200000000) as ctx: - ctx.insert("100000000 1\n") - ctx.insert("150000000 1\n") - ctx.insert("199999999 1\n") + 100000000, 200000000.1) as ctx: + ctx.insert("100000000.1 1\n") + ctx.insert("150000000.00003 1\n") + ctx.insert("199999999.4 1\n") + eq_(list(client.stream_intervals("/rounding/test")), + [ [ 100000000, 200000000 ] ]) with assert_raises(ClientError): with client.stream_insert_context("/rounding/test", 200000000, 300000000) as ctx: ctx.insert("200000000 1\n") ctx.insert("250000000 1\n") + # Server will round this and give an error on finalize() ctx.insert("299999999.99 1\n") client.stream_destroy("/rounding/test") diff --git a/tests/test_cmdline.py b/tests/test_cmdline.py index 884b386..32bf20f 100644 --- a/tests/test_cmdline.py +++ b/tests/test_cmdline.py @@ -231,11 +231,10 @@ class TestCmdline(object): eq_(parse_time("snapshot-20120405-140000.raw.gz"), test) eq_(parse_time("prep-20120405T1400"), test) eq_(parse_time("1333648800.0"), test) - try: - eq_(parse_time("1333648800000000"), test) - eq_(parse_time("@1333648800000000"), test) - except AssertionError: - warnings.warn("parsing int64 timestamps isn't working") + eq_(parse_time("1333648800000000"), test) + eq_(parse_time("@1333648800000000"), test) + with assert_raises(ValueError): + parse_time("@hashtag12345") def test_03_info(self): self.ok("info")