File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -443,12 +443,10 @@ def format_attribute(attr):
443443 return f"`{ attr } `"
444444 return f"({ attr } )"
445445
446- try :
447- match = re .match (
448- r"(?P<unique>unique\s+)?index\s*\(\s*(?P<args>.*)\)" , line , re .I
449- ).groupdict ()
450- except AttributeError :
446+ match = re .match (r"(?P<unique>unique\s+)?index\s*\(\s*(?P<args>.*)\)" , line , re .I )
447+ if match is None :
451448 raise DataJointError (f'Table definition syntax error in line "{ line } "' )
449+ match = match .groupdict ()
452450
453451 attr_list = re .findall (r"(?:[^,(]|\([^)]*\))+" , match ["args" ])
454452 index_sql .append (
Original file line number Diff line number Diff line change @@ -341,3 +341,12 @@ class WithSuchALongPartNameThatItCrashesMySQL(dj.Part):
341341 definition = """
342342 -> (master)
343343 """
344+
345+ @staticmethod
346+ @raises (dj .DataJointError )
347+ def test_regex_mismatch ():
348+ @schema
349+ class IndexAttribute (dj .Manual ):
350+ definition = """
351+ index: int
352+ """
You can’t perform that action at this time.
0 commit comments