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 @@ -139,6 +139,18 @@ def test_validation(self):
139
139
with self .assertRaises (ValueError ):
140
140
self .api .differential .find (query = '1' , guids = '1' )
141
141
142
+ def test_map_param_type (self ):
143
+ uint = 'uint'
144
+ self .assertEqual (phabricator .map_param_type (uint ), int )
145
+
146
+ list_bool = 'list<bool>'
147
+ self .assertEqual (phabricator .map_param_type (list_bool ), [bool ])
148
+
149
+ list_pair = 'list<pair<callsign, path>>'
150
+ self .assertEqual (phabricator .map_param_type (list_pair ), [tuple ])
151
+
152
+ complex_list_pair = 'list<pair<string-constant<"gtcm">, string>>'
153
+ self .assertEqual (phabricator .map_param_type (complex_list_pair ), [tuple ])
142
154
143
155
if __name__ == '__main__' :
144
156
unittest .main ()
You can’t perform that action at this time.
0 commit comments