-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathpython.py
40 lines (31 loc) · 1005 Bytes
/
python.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
# 1. Example ------------------------
import unittest
def median(pool):
copy = sorted(pool)
size = len(copy)
if size % 2 == 1:
return copy[(size - 1) / 2]
else:
return (copy[size/2 - 1] + copy[size/2]) / 2
class TestMedian(unittest.TestCase):
def testMedian(self):
self.failUnlessEqual(median([2, 9, 9, 7, 9, 2, 4, 5, 8]), 7)
if __name__ == '__main__':
unittest.main()
# 2. Tests ------------------------
# Function definition is here
def printme( str ):
"This prints a passed string into this function"
print str
return;
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
self.error = MDText()
self.add_widget(self.error, canvas='after')
class FloatingAction(Factory.IconButton):
action = ObjectProperty(allownone=True)
def _show(self, *args):
Animation.cancel_all(self)
Animation(font_size=self.target_font_size),
d=0.1,
t='linear').start(self)