History

python/tests/test_cvec.py: more tests

Paul Brossier committed 10 years ago

Commit 5dc1abc1 parent fb3f62e1 file · +32 −0Browse files

Showing the changes to python/tests (1 of 1 file). Show all

Unified · Split

python/tests/test_cvec.py+32−0
@@ -46,6 +46,38 @@ class aubio_cvec_test_case(TestCase): · 45 unmodified lines
46 assert_equal(spec.phas[39:-1], -np.pi)46 assert_equal(spec.phas[39:-1], -np.pi)
47 assert_equal(spec.norm, 0)47 assert_equal(spec.norm, 0)
48 48
49 def test_assign_cvec_with_other_cvec(self):
50 """ check dest cvec is still reachable after source was deleted """
51 spec = cvec(1024)
52 a = np.random.rand(1024/2+1).astype(float_type)
53 b = np.random.rand(1024/2+1).astype(float_type)
54 spec.norm = a
55 spec.phas = b
56 new_spec = spec
57 del spec
58 assert_equal(a, new_spec.norm)
59 assert_equal(b, new_spec.phas)
60 assert_equal(id(a), id(new_spec.norm))
61 assert_equal(id(b), id(new_spec.phas))
62
63 def test_pass_to_numpy(self):
64 spec = cvec(1024)
65 norm = spec.norm
66 phas = spec.phas
67 del spec
68 new_spec = cvec(1024)
69 new_spec.norm = norm
70 new_spec.phas = phas
71 assert_equal(norm, new_spec.norm)
72 assert_equal(phas, new_spec.phas)
73 assert_equal(id(norm), id(new_spec.norm))
74 assert_equal(id(phas), id(new_spec.phas))
75 del norm
76 del phas
77 assert_equal(new_spec.norm, 0.)
78 assert_equal(new_spec.phas, 0.)
79 del new_spec
80
49if __name__ == '__main__':81if __name__ == '__main__':
50 from nose2 import main82 from nose2 import main
51 main()83 main()

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t