File tree Expand file tree Collapse file tree
crates/static-analysis-kernel/src/analysis/languages/python Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -318,13 +318,8 @@ fn parse_future_import_statement<'text>(
318318}
319319
320320/// Constructs a [`MaybeAliased`] from the provided `node`. This is intended to be used on
321- /// the `name` and `module_name` field children.
322- ///
323- /// # Panics
324- /// Panics if the provided node isn't a:
325- /// * `dotted_name`
326- /// * `aliased_import`
327- /// * `relative_import`
321+ /// the `name` and `module_name` field children. Returns `None` if the node isn't a
322+ /// `relative_import`, `dotted_name`, or an `aliased_import`.
328323fn parse_field_child_node < ' text > (
329324 source_code : & ' text str ,
330325 node : tree_sitter:: Node ,
@@ -481,7 +476,7 @@ mod tests {
481476 }
482477
483478 #[ test]
484- fn error_node_does_not_panic ( ) {
479+ fn parse_imports_error_node ( ) {
485480 let code = "import foo, + bar" ;
486481 let tree = get_tree ( code, & Language :: Python ) . unwrap ( ) ;
487482 assert ! ( tree. root_node( ) . has_error( ) ) ;
@@ -496,7 +491,7 @@ mod tests {
496491 }
497492
498493 #[ test]
499- fn all_error_nodes_does_not_panic ( ) {
494+ fn parse_imports_all_error_nodes ( ) {
500495 let code = "import +, +" ;
501496 let tree = get_tree ( code, & Language :: Python ) . unwrap ( ) ;
502497 assert ! ( tree. root_node( ) . has_error( ) ) ;
You can’t perform that action at this time.
0 commit comments