def test_mode_1(): entry = 'hello world' sink = Datasink(root, namemode=1) sink.write(entry) f = str(sink._filepath) sink.close() # Filename is unix timestamp, should be long assert len(f.split('/')[-1]) > 12 assert open(f).readline() == entry + '\n' del sink shutil.rmtree(root)
def test_mode_0(): entry = 'hello world' sink = Datasink(root, namemode=0) sink.write(entry) f = str(sink._filepath) sink.close() # Filename is smallest time unit, shouldn't be too long assert len(f.split('/')[-1]) < 8 assert open(f).readline() == entry + '\n' del sink shutil.rmtree(root)