diff --git a/test/generate_random_test_data.py b/test/generate_random_test_data.py index 06e0320e..e6077d40 100755 --- a/test/generate_random_test_data.py +++ b/test/generate_random_test_data.py @@ -262,7 +262,7 @@ def get_constrained_cell_value(table, column, row_num, prev_inserts): + "".join(random.choices(string.ascii_lowercase, k=TOKEN_LENGTH)) ) elif CONFIG[table][column]["datatype"] in ["integer", "real", "numeric"]: - # No leading 0s: + # No leading zeros: cell = "".join(random.choices("123456789", k=1)) + "".join( random.choices(string.digits, k=TOKEN_LENGTH - 1) ) @@ -271,7 +271,8 @@ def get_constrained_cell_value(table, column, row_num, prev_inserts): cell + "." + "".join(random.choices("0123456789", k=1)) - + "".join(random.choices(string.digits, k=3)) + # No trailing zeros: + + "".join(random.choices("123456789", k=3)) ) else: print( @@ -357,7 +358,7 @@ def main(): + "".join(random.choices(string.ascii_lowercase, k=TOKEN_LENGTH)) ) elif CONFIG[table][column]["datatype"] == "text": - # No leading 0s: + # No leading zeros: cell = "".join(random.choices("123456789", k=1)) + "".join( random.choices(string.digits, k=TOKEN_LENGTH - 1) ) @@ -367,13 +368,15 @@ def main(): cell + "." + "".join(random.choices("0123456789", k=1)) - + "".join(random.choices(string.digits, k=3)) + # No trailing zeros: + + "".join(random.choices("123456789", k=3)) ) elif CONFIG[table][column]["datatype"] != "integer": cell = "".join(random.choices(string.ascii_lowercase, k=TOKEN_LENGTH)) elif random.choice([True, False]): cell = "".join(random.choices(string.ascii_lowercase, k=TOKEN_LENGTH)) else: + # No leading zeros: cell = "".join(random.choices("123456789", k=1)) + "".join( random.choices(string.digits, k=TOKEN_LENGTH - 1) ) @@ -381,7 +384,8 @@ def main(): cell + "." + "".join(random.choices("0123456789", k=1)) - + "".join(random.choices(string.digits, k=3)) + # No trailing zeros: + + "".join(random.choices("123456789", k=3)) ) row[column] = cell diff --git a/test/random_test_data/column.tsv b/test/random_test_data/column.tsv index 80268a30..58963e48 100644 --- a/test/random_test_data/column.tsv +++ b/test/random_test_data/column.tsv @@ -28,7 +28,7 @@ table2 child trimmed_line from(table4.other_foreign_column) table2 parent empty trimmed_line tree(child) table2 xyzzy empty trimmed_line under(table2.child, d) table2 foo empty integer from(table4.numeric_foreign_column) -table2 bar empty text +table2 bar empty numeric table3 source prefix from(table1.prefix) table3 id CURIE unique table3 label label primary @@ -38,7 +38,7 @@ table4 foreign_column text unique table4 other_foreign_column text unique table4 numeric_foreign_column integer primary table5 foo word primary -table5 bar integer +table5 bar real table6 child integer from(table4.numeric_foreign_column) table6 parent empty integer tree(child) table6 xyzzy empty integer under(table6.child, 4) diff --git a/test/random_test_data/datatype.tsv b/test/random_test_data/datatype.tsv index c118588d..c162ca56 100644 --- a/test/random_test_data/datatype.tsv +++ b/test/random_test_data/datatype.tsv @@ -11,12 +11,14 @@ label trimmed_line match(/\S([^\n]*\S)*/) line text exclude(/\n/) a line of text input natural_number integer match(/\d+/) a natural number, including zero INTEGER INTEGER nonspace trimmed_line exclude(/\s/) text without whitespace +numeric nonspace match(/-?\d+(\.\d+)?/) a positive or negative number NUMERIC NUMERIC path line exclude(/\n/) a path to a file prefix word exclude(/\W/) a prefix for a CURIE +real nonspace match(/-?\d+(\.\d+)?/) a positive or negative real number REAL REAL suffix word exclude(/\W/) a suffix for a CURIE table_name word exclude(/\W/) a table name table_type word lowercase in('table', 'column', 'datatype') a table type -text any text TEXT TEXT xsd:string textarea +text any text TEXT VARCHAR(100) xsd:string textarea trimmed_line line match(/\S([^\n]*\S)*/) a line of text that does not begin or end with whitespace trimmed_text text exclude(/^\s+|\s+$/) text that does not begin or end with whitespace word nonspace exclude(/\W/) a single word: letters, numbers, underscore