def test_prefix_columns(self, prefix_columns): with tempfile.TemporaryDirectory(prefix='co2mpas_%s_'%__name__) as d: datasync.do_datasync('x', 'y1', '%s#Sheet1!' % _sync_fname, out_path=osp.join(d, _synced_fname), prefix_cols=prefix_columns, ) _check_synced(self, osp.join(d, _synced_fname), 'Sheet1', prefix_columns)
def test_empty_sheet(self, case): inp_path, ref_sheet, sync_sheets = case with tempfile.TemporaryDirectory(prefix='co2mpas_%s_' % __name__) as d: datasync.do_datasync('x', 'y1', '%s#%s!' % (inp_path, ref_sheet), *sync_sheets, out_path=osp.join(d, _synced_fname)) _check_synced(self, osp.join(d, _synced_fname), 'Sheet1')
def test_bad_columns(self, case): from tests import _tutils as tutils # XXX import chaos if outside! x, y = case with tempfile.TemporaryDirectory(prefix='co2mpas_%s_'%__name__) as d: with tutils.assertRaisesRegex(self, cmain.CmdException, 'not found in rows'): datasync.do_datasync(x, y, '%s#Sheet1!' % _sync_fname, 'Sheet2', out_path=osp.join(d, _synced_fname), )
def test_bad_columns(self, case): from tests import _tutils as tutils # XXX import chaos if outside! x, y = case with tempfile.TemporaryDirectory(prefix='co2mpas_%s_' % __name__) as d: with tutils.assertRaisesRegex(self, cmain.CmdException, "Cannot read sync-sheet\([^\)]*\) due to: Columns \([^\)]*\) " "not found in table of sheet\([^\)]*\) in book\([^\)]*\)!"): datasync.do_datasync(x, y, '%s#Sheet1!' % _sync_fname, 'Sheet2', out_path=osp.join(d, _synced_fname), )