From 826f3a188b735d79195a95b9ce60fdd1ed24fa11 Mon Sep 17 00:00:00 2001 From: CyrilFerlicot Date: Thu, 24 Oct 2024 14:32:41 +0200 Subject: [PATCH] Add tests about variables of the same name in different classes --- .../FamixPythonProject1Test.class.st | 24 +++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/src/Famix-Python-Importer-Tests/FamixPythonProject1Test.class.st b/src/Famix-Python-Importer-Tests/FamixPythonProject1Test.class.st index c0eb9d9..7a88d4e 100644 --- a/src/Famix-Python-Importer-Tests/FamixPythonProject1Test.class.st +++ b/src/Famix-Python-Importer-Tests/FamixPythonProject1Test.class.st @@ -150,6 +150,18 @@ FamixPythonProject1Test >> testClassVariableSourceAnchor [ self assert: variable sourceAnchor endPos equals: 581 ] +{ #category : 'tests - attributes' } +FamixPythonProject1Test >> testClassVariablesWithSameNameButDifferenClass [ + + | variables | + variables := self model allAttributes select: [ :variable | variable name = 'furniture_color' ]. + + self assert: variables size equals: 2. + self assertCollection: (variables flatCollect: #parents) hasSameElements: { + (self classNamed: 'Chair'). + (self classNamed: 'Stool') } +] + { #category : 'tests - methods' } FamixPythonProject1Test >> testConstructor [ @@ -602,6 +614,18 @@ FamixPythonProject1Test >> testInstanceVariableSourceAnchor [ self assert: variable sourceAnchor endPos equals: 361 ] +{ #category : 'tests - attributes' } +FamixPythonProject1Test >> testInstanceVariablesWithSameNameButDifferenClass [ + + | variables | + variables := self model allAttributes select: [ :variable | variable name = 'number_of_legs' ]. + + self assert: variables size equals: 2. + self assertCollection: (variables flatCollect: #parents) hasSameElements: { + (self classNamed: 'Chair'). + (self classNamed: 'Stool') } +] + { #category : 'tests - from-import' } FamixPythonProject1Test >> testMethodImportsClassFromAModule [