diff --git a/src/Famix-Python-Importer-Tests/FamixPythonProject1Test.class.st b/src/Famix-Python-Importer-Tests/FamixPythonProject1Test.class.st index 69b2e9d..614c428 100644 --- a/src/Famix-Python-Importer-Tests/FamixPythonProject1Test.class.st +++ b/src/Famix-Python-Importer-Tests/FamixPythonProject1Test.class.st @@ -1608,6 +1608,15 @@ FamixPythonProject1Test >> testImportTwoStubPackagesOfTheSameName [ self assert: ((self moduleNamed: 'moduleWithStubs') outgoingImports anySatisfy: [ :import | import importedEntity = numpy ]) ] +{ #category : 'tests - imports' } +FamixPythonProject1Test >> testImportWithTheNameOfAStubClass [ + + | module | + module := self moduleNamed: 'moduleWithStubImport'. + + module outgoingImports do: [ :import | self deny: (import importedEntity isKindOf: FamixPythonClass) ] +] + { #category : 'tests - inheritances' } FamixPythonProject1Test >> testInheritanceDoesNotCreateReference [ "Regression test" diff --git a/src/Famix-Python-Importer/FamixPythonAbstractImportResolvable.class.st b/src/Famix-Python-Importer/FamixPythonAbstractImportResolvable.class.st index eabfe98..27b189d 100644 --- a/src/Famix-Python-Importer/FamixPythonAbstractImportResolvable.class.st +++ b/src/Famix-Python-Importer/FamixPythonAbstractImportResolvable.class.st @@ -39,7 +39,7 @@ FamixPythonAbstractImportResolvable >> findTargetEntityFor: aPath from: startEnt | possibleEntities splittedPath | "We need to trim because we can have spaces between the dots." splittedPath := (aPath splitOn: $.) collect: [ :segment | segment trim ]. - possibleEntities := startEntities select: [ :possibleEntity | possibleEntity name = splittedPath first ]. + possibleEntities := startEntities select: [ :possibleEntity | possibleEntity name = splittedPath first and: [ possibleEntity isStub not ] ]. splittedPath removeFirst. [ splittedPath isNotEmpty ] whileTrue: [ | childName | diff --git a/src/Famix-Python-Importer/FamixPythonFromImportResolvable.class.st b/src/Famix-Python-Importer/FamixPythonFromImportResolvable.class.st index d56d145..37c8f0a 100644 --- a/src/Famix-Python-Importer/FamixPythonFromImportResolvable.class.st +++ b/src/Famix-Python-Importer/FamixPythonFromImportResolvable.class.st @@ -51,7 +51,7 @@ FamixPythonFromImportResolvable >> resolveInScope: aScope currentEntity: current possibleEntities := currentPackage children ] ifFalse: [ "If we have an absolute path we just start at the root." remainingPath := path. - possibleEntities := currentEntity mooseModel rootEntities ]. + possibleEntities := currentEntity mooseModel modelRootEntities ]. "We trim the path because we can have spaces after the dots in relativ paths." possibleEntities := (self findTargetEntityFor: remainingPath trim from: possibleEntities) allChildren select: [ :child | diff --git a/src/Famix-Python-Importer/FamixPythonImporter.class.st b/src/Famix-Python-Importer/FamixPythonImporter.class.st index 9bd5ca5..b17080b 100644 --- a/src/Famix-Python-Importer/FamixPythonImporter.class.st +++ b/src/Famix-Python-Importer/FamixPythonImporter.class.st @@ -28,6 +28,20 @@ FamixPythonImporter class >> import: aFileName [ import: aFileName ] +{ #category : 'dev-utils' } +FamixPythonImporter class >> importBeerTradingBot [ + +