def initialize(self, path, fwparams, headers, fileparams): self.path, self.fileparams = textfile.initialize_file(path, fileparams) if not fwparams.get('fieldwidths'): raise AttributeError self.fwparams = fwparams self.headers = headers
def initialize(self, path, csvparams, headers, fileparams): self.path, self.fileparams = textfile.initialize_file(path, fileparams) self.csvparams = {} if not csvparams else csvparams self.headers = headers
def test_initialize_file(csv_with_headers): path = csv_with_headers assert textfile.initialize_file(path) == (path, {}) with pytest.raises(IOError): textfile.initialize_file('does_not_exist')