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

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

#126 Added CommentBlock to clean up the messy comment handling code.

File size: 1.3 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 # @return String with ok if this is translated properly.
15 return("2ok")
16 @staticmethod
17 def overrideif() -> str:
18 '''
19 some multi-line javadoc <br>
20 second comment line.
21
22 @return some ok string
23 '''
24 return("3ok")
25 return "3ko"
26 @staticmethod
27 def overrideif2() -> str:
28 if True: return("4ok")
29 return ("4ko")
30 @staticmethod
31 def overridenothing() -> str:
32 # comment should remain here.
33 return "5ok"
34 @staticmethod
35 def overrideWithEmpty() -> str:
36
37 @staticmethod
38 def overrideWithEmpty2() -> str:
39 @staticmethod
40 def main(args:List[str]) -> None:
41 sys.stdout.write(TranslationHints.fulloverride()+'\n')
42 sys.stdout.write(TranslationHints.fulloverride2()+'\n')
43 sys.stdout.write(TranslationHints.overrideif()+'\n')
44 sys.stdout.write(TranslationHints.overrideif2()+'\n')
45 sys.stdout.write(TranslationHints.overridenothing()+'\n')
46 sys.stdout.write(TranslationHints.overrideWithEmpty()+'\n')
47 sys.stdout.write(TranslationHints.overrideWithEmpty2()+'\n')
48
49if __name__ == "__main__":
50 TranslationHints.main(sys.argv[1:])
Note: See TracBrowser for help on using the repository browser.