Jim Paris
cc4e3bdb76
More work with nilmdb.stream_insert. Checks for overlap between parser output and database intervals, and actually inserts the data into pytables. Need to benchmark/figure out whether we can use table.append rather than the row.append() nonsense -- it could simplify things quite a bit. Improve layout class and add tests to get more coverage. Better error handling on invalid inputs (reports the reason for the error) Replace layout.fillrow with layout.filltable, but turns out that we can probably just remove it anyway. Add nilmdb.Timer for simple timing tests Move some duplicated test suite helper functions into a new file, test_helper.py Add class to test_interval.py to match the others git-svn-id: https://bucket.mit.edu/svn/nilm/nilmdb@10661 ddd99763-3ecb-0310-9145-efcb8ce7c51f
28 lines
745 B
Python
28 lines
745 B
Python
import nilmdb
|
|
from nilmdb.printf import *
|
|
|
|
from nose.tools import *
|
|
from nose.tools import assert_raises
|
|
from cStringIO import StringIO
|
|
import sys
|
|
|
|
from test_helpers import *
|
|
|
|
class TestPrintf(object):
|
|
def test_printf(self):
|
|
old_stdout = sys.stdout
|
|
sys.stdout = test1 = StringIO()
|
|
test2 = StringIO()
|
|
test3 = ""
|
|
try:
|
|
printf("hello, world: %d", 123)
|
|
fprintf(test2, "hello too: %d", 123)
|
|
test3 = sprintf("hello three: %d", 123)
|
|
except:
|
|
sys.stdout = old_stdout
|
|
raise
|
|
sys.stdout = old_stdout
|
|
eq_(test1.getvalue(), "hello, world: 123")
|
|
eq_(test2.getvalue(), "hello too: 123")
|
|
eq_(test3, "hello three: 123")
|