@classmethod
    def csv_to_import(cls, name=None, num_rows=None, column_headers=None, data_rows=None):
        if not num_rows:
            if data_rows:
                num_rows = len(data_rows)
            else:
                num_rows = cls.rand_int(start=2, end=10)
        if not column_headers:
            column_headers = [cls.rand_str() for i in range(0, cls.rand_int(end=20))]

        if not name:
            f = NamedTemporaryFile(delete=False)
        else:
            tempdir = mkdtemp()
            f = open(os.path.join(tempdir, name), 'w')

        with open(f.name, 'wb') as csvfile:
            csv_writer = csv.writer(csvfile)
            csv_writer.writerow(column_headers)
            if data_rows:
                for r in data_rows:
                    csv_writer.writerow(r)
            else:
                for i in range(0, num_rows):
                    row = [(i, cls.rand_int()) % "%s-%s" for h in range(0, len(column_headers))]
                    csv_writer.writerow(row)

        return f
dataset/ETHPy150Open buildingenergy/buildingenergy-platform/test_helpers.py/Factory.csv_to_import/swapped operands of `%`