Improve random query generation

...throw in the occasional `NOT`
This commit is contained in:
Colin Dellow 2018-07-04 19:14:35 -04:00
parent 373616ad1e
commit 5b26a78c1f
1 changed files with 3 additions and 1 deletions

View File

@ -47,7 +47,9 @@ def generate_statement(conn, table, column_values, all_values):
if random.randint(0, 1) == 0: if random.randint(0, 1) == 0:
values = all_values values = all_values
value = values[random.randint(0, len(values) - 1)] value = values[random.randint(0, len(values) - 1)]
query += field + ' ' + op + ' ' + str(value) if random.randint(0, 5) == 0:
query += ' NOT '
query += '(' + field + ' ' + op + ' ' + str(value) + ')'
if random.randint(0, 3) == 0: if random.randint(0, 3) == 0:
how_many = random.randint(0, 15) how_many = random.randint(0, 15)