-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMagicConstantTest.py
44 lines (37 loc) · 1.86 KB
/
MagicConstantTest.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
41
42
43
44
import os
from test.StratumTestCase import StratumTestCase
class MagicConstantTest(StratumTestCase):
# ------------------------------------------------------------------------------------------------------------------
def test1(self):
"""
Test constant __ROUTINE__. Must return name of routine.
"""
ret = self._dl.tst_magic_constant01()
self.assertEqual('tst_magic_constant01', ret)
# ------------------------------------------------------------------------------------------------------------------
def test2(self):
"""
Test constant __LINE__. Must return line number in the source code.
"""
ret = self._dl.tst_magic_constant02()
self.assertEqual(9, int(ret))
# ------------------------------------------------------------------------------------------------------------------
def test3(self):
"""
Test constant __FILE__. Must return the filename of the source of the routine.
"""
dir_cur_file = os.path.dirname(os.path.abspath(__file__))
path = os.path.realpath(dir_cur_file + "/psql/tst_magic_constant03.psql")
filename = os.path.realpath(path)
ret = self._dl.tst_magic_constant03()
self.assertEqual(filename, ret)
# ------------------------------------------------------------------------------------------------------------------
def test4(self):
"""
Test constant __DIR__. Must return name of the folder where the source file of routine the is located.
"""
dir_cur_file = os.path.dirname(os.path.abspath(__file__))
dir_name = os.path.realpath(dir_cur_file + '/psql')
ret = self._dl.tst_magic_constant04()
self.assertEqual(dir_name, ret)
# ----------------------------------------------------------------------------------------------------------------------