def generate_test_file(delim, record_cnt, quoting):
    (fd, fqfn) = tempfile.mkstemp()
    fp = os.fdopen(fd,"w")

    for i in range(record_cnt):
        fields = []

        fields.append(str(i))                         # field 0: id_col

        if i % 4 == 0:                                # field 1: very mixed col
           fields.append('A')
        elif i % 5 == 0:
           fields.append('b')
        elif i % 3 == 0:
           fields.append('C')
        elif i % 2 == 0:
           fields.append('d')
        else:
           fields.append('E')
        #print '%d - %s' % (i, fields[len(fields)-1]) 

        fields.append('bbbbb')                        # field 2: lower col
        fields.append('CCC')                          # field 3: upper col
        fields.append('')                             # field 4: empty col
        fields.append('999.9')                        # field 5: float col
        fields.append('aaa')                          # field 6: extra string col
        outrec = delim.join(fields)+'\n'
        fp.write(outrec)

    fp.close()
    return fqfn
generic file generator used by multiple test classes
dataset/ETHPy150Open kenfar/DataGristle/gristle/tests/test_field_determinator.py/generate_test_file