# Path: tacl/exceptions.py
# class MalformedResultsError(TACLError):
# 
#     pass


import csv
import filecmp
import io
import os.path
import shlex
import subprocess
import unittest
import unittest.mock
import tacl
from tacl.exceptions import MalformedResultsError
    def _test_required_columns(self, cols, cmd, *args, **kwargs):
        """Tests that when `cmd` is run with `args` and `kwargs`, it raises a
        `MalformedResultsError when each of `cols` is not present in
        the results. Further tests that that exception is not raised
        when other columns are not present.

        This test is designed to test Results methods only.

        """
        input_results = (
            ['AB', '2', 'T1', 'base', '4', 'A'],
            ['AB', '2', 'T1', 'a', '3', 'A'],
            ['AB', '2', 'T2', 'base', '2', 'A'],
            ['ABC', '3', 'T1', 'base', '2', 'A'],
            ['ABC', '3', 'T1', 'a', '0', 'A'],
            ['AB', '2', 'T3', 'base', '2', 'B'],
            ['BC', '2', 'T1', 'base', '3', 'A'],
        )
        for col in tacl.constants.QUERY_FIELDNAMES:
            fs = list(tacl.constants.QUERY_FIELDNAMES[:])
            index = fs.index(col)
            fs[index] = 'dummy'
            fh = self._create_csv(input_results, fieldnames=fs)
            results = tacl.Results(fh, self._tokenizer)
            if col in cols:
                self.assertRaises(MalformedResultsError, getattr(results, cmd),
                                  *args, **kwargs)
            else:
                try:
                    getattr(results, cmd)(*args, **kwargs)

# Path: tacl/exceptions.py
# class MalformedResultsError(TACLError):
# 
#     pass


# Path: tests/tacl_test_case.py
import csv
import filecmp
import io
import os.path
import shlex
import subprocess
import unittest
import unittest.mock
import tacl
from tacl.exceptions import MalformedResultsError

    def _test_required_columns(self, cols, cmd, *args, **kwargs):
        """Tests that when `cmd` is run with `args` and `kwargs`, it raises a
        `MalformedResultsError when each of `cols` is not present in
        the results. Further tests that that exception is not raised
        when other columns are not present.

        This test is designed to test Results methods only.

        """
        input_results = (
            ['AB', '2', 'T1', 'base', '4', 'A'],
            ['AB', '2', 'T1', 'a', '3', 'A'],
            ['AB', '2', 'T2', 'base', '2', 'A'],
            ['ABC', '3', 'T1', 'base', '2', 'A'],
            ['ABC', '3', 'T1', 'a', '0', 'A'],
            ['AB', '2', 'T3', 'base', '2', 'B'],
            ['BC', '2', 'T1', 'base', '3', 'A'],
        )
        for col in tacl.constants.QUERY_FIELDNAMES:
            fs = list(tacl.constants.QUERY_FIELDNAMES[:])
            index = fs.index(col)
            fs[index] = 'dummy'
            fh = self._create_csv(input_results, fieldnames=fs)
            results = tacl.Results(fh, self._tokenizer)
            if col in cols:
                self.assertRaises(MalformedResultsError, getattr(results, cmd),
                                  *args, **kwargs)
            else:
                try:
                    getattr(results, cmd)(*args, **kwargs)

                except MalformedResultsError: