source: java2python/core/test/testcode/TranslationHints.py@ 476

Last change on this file since 476 was 476, checked in by wouter, 18 months ago

#146 fix import statement from Stub

File size: 1.4 KB
Line 
1import sys
2from typing import List
3
4
5class TranslationHints:
6 '''
7 This class has annotations that override the standard translation process
8 After translation, all functions should print "ok"
9
10 '''
11 def fulloverride(): return ("1ok")
12 @staticmethod
13 def fulloverride2() -> str:
14 '''
15 @return String with ok if this is translated properly. This prints 2ko in
16 java, 2ok in python.
17 '''
18 return("2ok")
19 @staticmethod
20 def overrideif() -> str:
21 '''
22 some multi-line javadoc <br>
23 second comment line.
24
25 @return some ok string
26 '''
27 return("3ok")
28 return "3ko"
29 @staticmethod
30 def overrideif2() -> str:
31 if True: return("4ok")
32 return ("4ko")
33 @staticmethod
34 def overridenothing() -> str:
35 # comment should remain here.
36 return "5ok"
37 @staticmethod
38 def overrideWithEmpty() -> str:
39 pass
40 return "6ok"
41 @staticmethod
42 def overrideWithEmpty2() -> str:
43 pass
44 return "7ok"
45 @staticmethod
46 def main(args:List[str]) -> None:
47 sys.stdout.write(TranslationHints.fulloverride()+'\n')
48 sys.stdout.write(TranslationHints.fulloverride2()+'\n')
49 sys.stdout.write(TranslationHints.overrideif()+'\n')
50 sys.stdout.write(TranslationHints.overrideif2()+'\n')
51 sys.stdout.write(TranslationHints.overridenothing()+'\n')
52 sys.stdout.write(TranslationHints.overrideWithEmpty()+'\n')
53 sys.stdout.write(TranslationHints.overrideWithEmpty2()+'\n')
54
55if __name__ == "__main__":
56 TranslationHints.main(sys.argv[1:])
Note: See TracBrowser for help on using the repository browser.