File tree Expand file tree Collapse file tree 2 files changed +12
-5
lines changed Expand file tree Collapse file tree 2 files changed +12
-5
lines changed Original file line number Diff line number Diff line change @@ -443,12 +443,10 @@ def format_attribute(attr):
443
443
return f"`{ attr } `"
444
444
return f"({ attr } )"
445
445
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 :
451
448
raise DataJointError (f'Table definition syntax error in line "{ line } "' )
449
+ match = match .groupdict ()
452
450
453
451
attr_list = re .findall (r"(?:[^,(]|\([^)]*\))+" , match ["args" ])
454
452
index_sql .append (
Original file line number Diff line number Diff line change @@ -341,3 +341,12 @@ class WithSuchALongPartNameThatItCrashesMySQL(dj.Part):
341
341
definition = """
342
342
-> (master)
343
343
"""
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