@@ -1288,25 +1288,6 @@ mod tests {
12881288 ) ;
12891289 }
12901290
1291- #[ test]
1292- fn single_file_takes_priority_over_namespace_package ( ) {
1293- //const SRC: &[FileSpec] = &[("foo.py", "x = 1")];
1294- const SRC : & [ FileSpec ] = & [ ( "foo.py" , "x = 1" ) , ( "foo/bar.py" , "x = 2" ) ] ;
1295-
1296- let TestCase { db, src, .. } = TestCaseBuilder :: new ( ) . with_src_files ( SRC ) . build ( ) ;
1297-
1298- let foo_module_name = ModuleName :: new_static ( "foo" ) . unwrap ( ) ;
1299- let foo_bar_module_name = ModuleName :: new_static ( "foo.bar" ) . unwrap ( ) ;
1300-
1301- // `foo.py` takes priority over the `foo` namespace package
1302- let foo_module = resolve_module ( & db, & foo_module_name) . unwrap ( ) ;
1303- assert_eq ! ( foo_module. file( ) . path( & db) , & src. join( "foo.py" ) ) ;
1304-
1305- // `foo.bar` isn't recognised as a module
1306- let foo_bar_module = resolve_module ( & db, & foo_bar_module_name) ;
1307- assert_eq ! ( foo_bar_module, None ) ;
1308- }
1309-
13101291 #[ test]
13111292 fn typing_stub_over_module ( ) {
13121293 const SRC : & [ FileSpec ] = & [ ( "foo.py" , "print('Hello, world!')" ) , ( "foo.pyi" , "x: int" ) ] ;
@@ -1349,82 +1330,6 @@ mod tests {
13491330 ) ;
13501331 }
13511332
1352- #[ test]
1353- fn namespace_package ( ) {
1354- // From [PEP420](https://peps.python.org/pep-0420/#nested-namespace-packages).
1355- // But uses `src` for `project1` and `site-packages` for `project2`.
1356- // ```
1357- // src
1358- // parent
1359- // child
1360- // one.py
1361- // site_packages
1362- // parent
1363- // child
1364- // two.py
1365- // ```
1366- let TestCase {
1367- db,
1368- src,
1369- site_packages,
1370- ..
1371- } = TestCaseBuilder :: new ( )
1372- . with_src_files ( & [ ( "parent/child/one.py" , "print('Hello, world!')" ) ] )
1373- . with_site_packages_files ( & [ ( "parent/child/two.py" , "print('Hello, world!')" ) ] )
1374- . build ( ) ;
1375-
1376- let one_module_name = ModuleName :: new_static ( "parent.child.one" ) . unwrap ( ) ;
1377- let one_module_path = FilePath :: System ( src. join ( "parent/child/one.py" ) ) ;
1378- assert_eq ! (
1379- resolve_module( & db, & one_module_name) ,
1380- path_to_module( & db, & one_module_path)
1381- ) ;
1382-
1383- let two_module_name = ModuleName :: new_static ( "parent.child.two" ) . unwrap ( ) ;
1384- let two_module_path = FilePath :: System ( site_packages. join ( "parent/child/two.py" ) ) ;
1385- assert_eq ! (
1386- resolve_module( & db, & two_module_name) ,
1387- path_to_module( & db, & two_module_path)
1388- ) ;
1389- }
1390-
1391- #[ test]
1392- fn regular_package_in_namespace_package ( ) {
1393- // Adopted test case from the [PEP420 examples](https://peps.python.org/pep-0420/#nested-namespace-packages).
1394- // The `src/parent/child` package is a regular package. Therefore, `site_packages/parent/child/two.py` should not be resolved.
1395- // ```
1396- // src
1397- // parent
1398- // child
1399- // one.py
1400- // site_packages
1401- // parent
1402- // child
1403- // two.py
1404- // ```
1405- const SRC : & [ FileSpec ] = & [
1406- ( "parent/child/__init__.py" , "print('Hello, world!')" ) ,
1407- ( "parent/child/one.py" , "print('Hello, world!')" ) ,
1408- ] ;
1409-
1410- const SITE_PACKAGES : & [ FileSpec ] = & [ ( "parent/child/two.py" , "print('Hello, world!')" ) ] ;
1411-
1412- let TestCase { db, src, .. } = TestCaseBuilder :: new ( )
1413- . with_src_files ( SRC )
1414- . with_site_packages_files ( SITE_PACKAGES )
1415- . build ( ) ;
1416-
1417- let one_module_path = FilePath :: System ( src. join ( "parent/child/one.py" ) ) ;
1418- let one_module_name =
1419- resolve_module ( & db, & ModuleName :: new_static ( "parent.child.one" ) . unwrap ( ) ) ;
1420- assert_eq ! ( one_module_name, path_to_module( & db, & one_module_path) ) ;
1421-
1422- assert_eq ! (
1423- None ,
1424- resolve_module( & db, & ModuleName :: new_static( "parent.child.two" ) . unwrap( ) )
1425- ) ;
1426- }
1427-
14281333 #[ test]
14291334 fn module_search_path_priority ( ) {
14301335 let TestCase {
0 commit comments