Debian Codegraph @

tests/c-hello/hellotest.py

raw symbols SCIP
1 import sys
2 import gc
3 import os.path
4 sys.path.insert(0, os.path.join(os.path.dirname(os.path.abspath(__file__)),
5 '..', '..', 'build', 'default', 'tests', 'c-hello'))
6 import hello
7 import unittest
8
9
10 class TestHello(unittest.TestCase):
11
12 def test_func(self):
13 x = hello.sum(1, 2)
14 self.assertEqual(x, 3)
15
16 def test_foo(self):
17 foo = hello.Foo()
18 data = foo.get_data()
19 self.assertEqual(data, None)
20 del foo
21 while gc.collect():
22 pass
23
24 def test_foo2(self):
25 foo = hello.Foo("123")
26 data = foo.get_data()
27 self.assertEqual(data, "123")
28 del foo
29 while gc.collect():
30 pass
31
32 def test_foo3(self):
33 foo = hello.Foo(3)
34 data = foo.get_data()
35 self.assertEqual(data, " ")
36 del foo
37 while gc.collect():
38 pass
39
40 def test_null_ok(self):
41 foo = hello.Foo(3)
42
43 h1 = hello.get_hash(foo)
44 self.assertNotEqual(h1, -1)
45
46 h2 = hello.get_hash(None)
47 self.assertEqual(h2, -1)
48
49 h3 = hello.get_hash()
50 self.assertEqual(h3, -1)
51
52
53 if __name__ == '__main__':
54 unittest.main()