Skip to content

Commit

Permalink
References should manage imports and imports with aliases
Browse files Browse the repository at this point in the history
  • Loading branch information
jecisc committed Dec 9, 2024
1 parent e5fe5fa commit 175c7dc
Showing 1 changed file with 47 additions and 0 deletions.
47 changes: 47 additions & 0 deletions src/Famix-Python-Importer-Tests/FamixPythonProject1Test.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -2338,6 +2338,53 @@ FamixPythonProject1Test >> testReferenceFromPackage [
self assert: (package outgoingReferences anySatisfy: [ :aReference | aReference referredType = class ])
]

{ #category : 'tests - references' }
FamixPythonProject1Test >> testReferenceOfImportedEntity [

| class module reference |
class := self classNamed: 'Person'.
module := self moduleNamed: 'moduleAtRoot5'.

reference := class incomingReferences detect: [ :aReference | aReference referencer = module ].

self assert: reference class equals: FamixPythonReference.
self assert: reference source equals: module.
self assert: reference referencer equals: module.
self assert: reference target equals: class.
self assert: reference referredType equals: class.
self assert: (module outgoingReferences anySatisfy: [ :aReference | aReference referredType = class ])
]

{ #category : 'tests - references' }
FamixPythonProject1Test >> testReferenceOfImportedEntityViaAlias [

| class module reference |
class := self classNamed: 'Employee'.
module := self moduleNamed: 'moduleWithImportsAndAliases'.

reference := class incomingReferences detect: [ :aReference | aReference referencer = module ].

self assert: reference class equals: FamixPythonReference.
self assert: reference source equals: module.
self assert: reference referencer equals: module.
self assert: reference target equals: class.
self assert: reference referredType equals: class.
self assert: (module outgoingReferences anySatisfy: [ :aReference | aReference referredType = class ]).
]

{ #category : 'tests - references' }
FamixPythonProject1Test >> testReferenceOfImportedEntityViaAliasSourceAnchor [

| class module reference |
class := self classNamed: 'Employee'.
module := self moduleNamed: 'moduleWithImportsAndAliases'.

reference := class incomingReferences detect: [ :aReference | aReference referencer = module ].

self assert: reference sourceAnchor isNotNil.
self assert: reference sourceText equals: 'Emp'
]

{ #category : 'tests - references' }
FamixPythonProject1Test >> testReferenceSourceAnchor [

Expand Down

0 comments on commit 175c7dc

Please sign in to comment.