Skip to content

Commit

Permalink
fix: fix py test error issue
Browse files Browse the repository at this point in the history
  • Loading branch information
phodal committed Feb 20, 2020
1 parent 00dcb5b commit 659e7ad
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,8 @@ package chapi.ast.pythonast
import org.junit.jupiter.api.Test

internal class PythonAnalyserTest {
@Test
internal fun shouldIdentBuilderPattern() {

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,15 @@ internal class PythonFullIdentListenerTest {
internal fun shouldAnalysisPython2() {
val python2HelloWorld = """print("Hello, World!")"""

PythonAnalyser().analysis(python2HelloWorld, "")
val codeContainer = PythonAnalyser().analysis(python2HelloWorld, "py2.py")
assertEquals(codeContainer.FullName, "py2.py")
}

@Test
internal fun shouldAnalysisPython3() {
val py3HelloWorld = """print "Hello, World!""""
PythonAnalyser().analysis(py3HelloWorld, "")
val codeContainer = PythonAnalyser().analysis(py3HelloWorld, "py3.py")
assertEquals(codeContainer.FullName, "py3.py")
}

@Test
Expand Down
18 changes: 18 additions & 0 deletions chapi-ast-python/src/test/resources/call/builder_pattern_call.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
## https://stackoverflow.com/questions/17321167/calling-chains-methods-with-intermediate-results

class Person:
def setName(self, name):
self.name = name
return self ## this is what makes this work

def setAge(self, age):
self.age = age;
return self;

def setSSN(self, ssn):
self.ssn = ssn
return self


p = Person()
p.setName("Hunter").setAge(24).setSSN("111-22-3333")

0 comments on commit 659e7ad

Please # to comment.