Skip to content

Commit

Permalink
Add more tests on write accesses
Browse files Browse the repository at this point in the history
  • Loading branch information
jecisc committed Nov 20, 2024
1 parent 6c60d52 commit 3c90bdd
Showing 1 changed file with 36 additions and 0 deletions.
36 changes: 36 additions & 0 deletions src/Famix-Python-Importer-Tests/FamixPythonProject1Test.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -2120,6 +2120,24 @@ FamixPythonProject1Test >> testSuperclass2 [
self deny: class superclass isStub
]

{ #category : 'tests - accesses' }
FamixPythonProject1Test >> testWriteAccessFromClass [

| variable class access |
variable := self attributeNamed: 'kind'.
class := self classNamed: 'Dog'.

access := variable incomingAccesses detect: [ :anAccess | anAccess accessor = class ].

self assert: access class equals: FamixPythonAccess.
self assert: access source equals: class.
self assert: access accessor equals: class.
self assert: access target equals: variable.
self assert: access variable equals: variable.
self assert: access isWrite.
self assert: (class accesses anySatisfy: [ :anAccess | anAccess variable = variable ])
]

{ #category : 'tests - accesses' }
FamixPythonProject1Test >> testWriteAccessFromFunction [

Expand Down Expand Up @@ -2174,6 +2192,24 @@ FamixPythonProject1Test >> testWriteAccessFromLambda [
self assert: (lambda accesses anySatisfy: [ :anAccess | anAccess variable = variable ])
]

{ #category : 'tests - accesses' }
FamixPythonProject1Test >> testWriteAccessFromMethod [

| variable method access |
variable := self attributeNamed: 'dog_name'.
method := (self classNamed: 'Dog') methods detect: #isConstructor.

access := variable incomingAccesses detect: [ :anAccess | anAccess accessor = method ].

self assert: access class equals: FamixPythonAccess.
self assert: access source equals: method.
self assert: access accessor equals: method.
self assert: access target equals: variable.
self assert: access variable equals: variable.
self assert: access isWrite.
self assert: (method accesses anySatisfy: [ :anAccess | anAccess variable = variable ])
]

{ #category : 'tests - accesses' }
FamixPythonProject1Test >> testWriteAccessFromModule [

Expand Down

0 comments on commit 3c90bdd

Please sign in to comment.