-
Notifications
You must be signed in to change notification settings - Fork 44
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: <python> add basic builder call size suport
- Loading branch information
Showing
3 changed files
with
36 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
9 changes: 7 additions & 2 deletions
9
chapi-ast-python/src/test/kotlin/chapi/ast/pythonast/PythonAnalyserTest.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,21 @@ | ||
package chapi.ast.pythonast | ||
|
||
import org.junit.jupiter.api.Test | ||
import kotlin.test.assertEquals | ||
|
||
internal class PythonAnalyserTest { | ||
@Test | ||
internal fun shouldIdentBuilderPattern() { | ||
internal fun shouldIdentBuilderPatternSize() { | ||
val code = """ | ||
def build(): | ||
p = Person() | ||
p.setName("Hunter").setAge(24).setSSN("111-22-3333") | ||
""" | ||
val codeFile = PythonAnalyser().analysis(code, "") | ||
println(codeFile) | ||
val firstFunc = codeFile.DataStructures[0].Functions[0] | ||
assertEquals(firstFunc.FunctionCalls.size, 3) | ||
// assertEquals(firstFunc.FunctionCalls[0].FunctionName, "setName") | ||
// assertEquals(firstFunc.FunctionCalls[1].FunctionName, "setAge") | ||
// assertEquals(firstFunc.FunctionCalls[2].FunctionName, "setSSN") | ||
} | ||
} |