Exemplo n.º 1
0
def test_tubreader():
    with tempfile.TemporaryDirectory() as tempfolder:
        path = os.path.join(tempfolder, 'new')
        inputs = ['name', 'age', 'pic']
        types = ['str', 'float', 'str']
        writer = TubWriter(path, inputs=inputs, types=types)
        writer.run('will', 323, 'asdfasdf')
        assert writer.get_num_records() == 1

        reader = TubReader(path)
        assert reader.get_num_records() == 1

        record = reader.run('name', 'age', 'pic')
        assert set(record) == set(['will', 323, 'asdfasdf'])
Exemplo n.º 2
0
 def test_tub_path(self):
     tub = TubWriter(self.path, inputs=self.inputs, types=self.types)
     print(tub.types, tub.inputs)
     tub.run('will', 323, 'asdfasdf')