OILS / mycpp / examples / test_small_str.py View on Github | oilshell.org

33 lines, 17 significant
1#!/usr/bin/env python2
2from __future__ import print_function
3
4import os
5from mycpp.mylib import log
6
7
8def f(s):
9 # type: (str) -> str
10 return s[1].upper()
11
12
13def run_tests():
14 # type: () -> None
15
16 #a = 'foo' + 'bar'
17 a = 'food'
18 print(a.upper())
19
20 print(f(a))
21
22
23def run_benchmarks():
24 # type: () -> None
25 pass
26
27
28if __name__ == '__main__':
29 if os.getenv('BENCHMARK'):
30 log('Benchmarking...')
31 run_benchmarks()
32 else:
33 run_tests()