Skip to content

Commit

Permalink
Add tests on edge cases of ivar and cvar definition
Browse files Browse the repository at this point in the history
  • Loading branch information
jecisc committed Oct 23, 2024
1 parent 4d816c5 commit 439f605
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions src/Famix-Python-Importer-Tests/FamixPythonProject1Test.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,20 @@ FamixPythonProject1Test >> testClassImportsModule [
self assert: import sourceText equals: 'import moduleAtRoot3'
]

{ #category : 'tests - attributes' }
FamixPythonProject1Test >> testClassVariableNotAtTheBeginningOfTheClass [

| variable |
self denyEmpty: self model allAttributes.

variable := self attributeNamed: 'sound'.

self assert: variable class equals: FamixPythonAttribute.
self assert: variable name equals: 'sound'.
self assert: variable parentType equals: (self classNamed: 'Dog').
self assert: variable isClassSide
]

{ #category : 'tests - attributes' }
FamixPythonProject1Test >> testClassVariableSourceAnchor [

Expand Down Expand Up @@ -542,6 +556,20 @@ FamixPythonProject1Test >> testImportTwoStubPackagesOfTheSameName [
self assert: ((self moduleNamed: 'moduleWithStubs') outgoingImports anySatisfy: [ :import | import importedEntity = numpy ])
]

{ #category : 'tests - attributes' }
FamixPythonProject1Test >> testInstanceVariableDeclaredOutsideOfInit [

| variable |
self denyEmpty: self model allAttributes.

variable := self attributeNamed: 'dog_color'.

self assert: variable class equals: FamixPythonAttribute.
self assert: variable name equals: 'dog_color'.
self assert: variable parentType equals: (self classNamed: 'Dog').
self deny: variable isClassSide
]

{ #category : 'tests - from-import' }
FamixPythonProject1Test >> testMethodImportsClassFromAModule [

Expand Down

0 comments on commit 439f605

Please sign in to comment.