@@ -29,33 +29,62 @@ FASTPythonImporterTest >> setUp [
2929{ #category : ' tests' }
3030FASTPythonImporterTest >> testClassDefinition [
3131
32+ | class |
3233 self parse: ' class AClass():
3334 pass' .
3435
3536 self assert: (fast allWithType: FASTPythonModule ) size equals: 1 .
36- self assert: (fast allWithType: FASTPythonClassDefinition ) size equals: 1
37+ self assert: (fast allWithType: FASTPythonClassDefinition ) size equals: 1 .
38+
39+ class := (fast allWithType: FASTPythonClassDefinition ) anyOne.
40+ self assert: class name equals: ' AClass'
3741]
3842
3943{ #category : ' tests' }
4044FASTPythonImporterTest >> testFunctionDefinition [
4145
46+ | function |
4247 self parse: ' def test():
4348 return 1' .
4449
4550 self assert: (fast allWithType: FASTPythonModule ) size equals: 1 .
46- self assert: (fast allWithType: FASTPythonFunctionDefinition ) size equals: 1
51+ self assert: (fast allWithType: FASTPythonFunctionDefinition ) size equals: 1 .
52+
53+ function := (fast allWithType: FASTPythonFunctionDefinition ) anyOne.
54+ self assert: function name equals: ' test'
55+ ]
56+
57+ { #category : ' tests - parameters' }
58+ FASTPythonImporterTest >> testFunctionParameters [
59+
60+ | function |
61+ self parse: ' def add(a, b):
62+ return a + b' .
63+
64+ self assert: (fast allWithType: FASTPythonModule ) size equals: 1 .
65+ self assert: (fast allWithType: FASTPythonFunctionDefinition ) size equals: 1 .
66+ function := (fast allWithType: FASTPythonFunctionDefinition ) anyOne.
67+
68+ self assert: (fast allWithType: FASTPythonParameter ) size equals: 2 .
69+ self assertCollection: (fast allWithType: FASTPythonParameter ) hasSameElements: function parameters.
70+ function parameters do: [ :parameter | self assert: (parameter isOfType: FASTPythonParameter ) ].
71+ self assertCollection: (function parameters collect: #name ) hasSameElements: #( 'a' 'b' )
4772]
4873
4974{ #category : ' tests' }
5075FASTPythonImporterTest >> testMethodDefinition [
5176
77+ | method |
5278 self parse: ' class AClass():
5379 def method(self):
5480 pass' .
5581
5682 self assert: (fast allWithType: FASTPythonModule ) size equals: 1 .
5783 self assert: (fast allWithType: FASTPythonClassDefinition ) size equals: 1 .
5884 self assert: (fast allWithType: FASTPythonMethodDefinition ) size equals: 1 .
85+
86+ method := (fast allWithType: FASTPythonMethodDefinition ) anyOne.
87+ self assert: method name equals: ' method'
5988]
6089
6190{ #category : ' tests' }
@@ -73,23 +102,6 @@ FASTPythonImporterTest >> testOneComment [
73102 self assert: entity sourceCode equals: ' #There is only one comment'
74103]
75104
76- { #category : ' tests - parameters' }
77- FASTPythonImporterTest >> testParameters [
78-
79- | function |
80- self parse: ' def add(a, b):
81- return a + b' .
82-
83- self assert: (fast allWithType: FASTPythonModule ) size equals: 1 .
84- self assert: (fast allWithType: FASTPythonFunctionDefinition ) size equals: 1 .
85- function := (fast allWithType: FASTPythonFunctionDefinition ) anyOne.
86-
87- self assert: (fast allWithType: FASTPythonParameter ) size equals: 2 .
88- self assertCollection: (fast allWithType: FASTPythonParameter ) hasSameElements: function parameters.
89- function parameters do: [ :parameter | self assert: (parameter isOfType: FASTPythonParameter ) ].
90- self assertCollection: (function parameters collect: #name ) hasSameElements: #( 'a' 'b' )
91- ]
92-
93105{ #category : ' tests' }
94106FASTPythonImporterTest >> testTwoComments [
95107
0 commit comments