File tree Expand file tree Collapse file tree 2 files changed +15
-3
lines changed Expand file tree Collapse file tree 2 files changed +15
-3
lines changed Original file line number Diff line number Diff line change 103
103
'type' : string_types ,
104
104
}
105
105
106
- TYPE_INFO_COMMENT_RE = re .compile (r'\s*\([^)]+\)\s*|,.+ $' )
106
+ TYPE_INFO_COMMENT_RE = re .compile (r'\s*\([^)]+\)\s*$' )
107
107
TYPE_INFO_SPLITTER_RE = re .compile (r'(\w+(?:<.+>)?)(?:\s+|$)' )
108
- TYPE_INFO_RE = re .compile (r'(\w+)(<[^>]+>)?(?:\s +|$)' )
108
+ TYPE_INFO_RE = re .compile (r'<? (\w+)(<[^>]+>>? )?(?:. +|$)' )
109
109
110
110
111
111
def map_param_type (param_type ):
@@ -127,7 +127,7 @@ def map_param_type(param_type):
127
127
# Handle list of pairs: "optional list<pair<callsign, path>>"
128
128
sub_match = TYPE_INFO_RE .match (sub_type )
129
129
if sub_match :
130
- sub_type = sub_match .group (0 ).lower ()
130
+ sub_type = sub_match .group (1 ).lower ()
131
131
132
132
return [PARAM_TYPE_MAP .setdefault (sub_type , string_types )]
133
133
Original file line number Diff line number Diff line change @@ -159,6 +159,18 @@ def test_validation(self):
159
159
with self .assertRaises (ValueError ):
160
160
self .api .differential .find (query = '1' , guids = '1' )
161
161
162
+ def test_map_param_type (self ):
163
+ uint = 'uint'
164
+ self .assertEqual (phabricator .map_param_type (uint ), int )
165
+
166
+ list_bool = 'list<bool>'
167
+ self .assertEqual (phabricator .map_param_type (list_bool ), [bool ])
168
+
169
+ list_pair = 'list<pair<callsign, path>>'
170
+ self .assertEqual (phabricator .map_param_type (list_pair ), [tuple ])
171
+
172
+ complex_list_pair = 'list<pair<string-constant<"gtcm">, string>>'
173
+ self .assertEqual (phabricator .map_param_type (complex_list_pair ), [tuple ])
162
174
163
175
if __name__ == '__main__' :
164
176
unittest .main ()
You can’t perform that action at this time.
0 commit comments