Changeset 5dc1abc


Ignore:
Timestamp:
May 2, 2016, 2:56:40 PM (4 years ago)
Author:
Paul Brossier <piem@piem.org>
Branches:
feature/autosink, feature/constantq, feature/pitchshift, feature/pydocstrings, feature/timestretch, master, pitchshift, sampler, timestretch, yinfft+
Children:
36e95674
Parents:
fb3f62e
Message:

python/tests/test_cvec.py: more tests

File:
1 edited

Legend:

Unmodified
Added
Removed
  • python/tests/test_cvec.py

    rfb3f62e r5dc1abc  
    4747        assert_equal(spec.norm, 0)
    4848
     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
    4981if __name__ == '__main__':
    5082    from nose2 import main
Note: See TracChangeset for help on using the changeset viewer.