diff options
author | Michael Byers <ByersJR.Michael@gmail.com> | 2020-01-07 14:57:39 -0500 |
---|---|---|
committer | Marcus Müller <marcus@hostalia.de> | 2020-02-09 19:24:04 +0100 |
commit | deeece0502595dff0a27ed4ee8159ee64b7fb3ea (patch) | |
tree | 69c9b9fc2f54408fda88d54d66c2015df4ed54cd /gr-blocks/python | |
parent | 7d619aed8b8eb185890df2940cbee5de6062c4bd (diff) |
pmt: Fix RuntimeError in pmt_to_python
Python has a RuntimeError that's thrown during the pmt to_python function.
Instead of throwing this error, SWIG has been updated to throw a TypeError.
This allows us to keep the same behavior whereby we iterate over PMT types
until the proper conversion is found
Diffstat (limited to 'gr-blocks/python')
-rw-r--r-- | gr-blocks/python/blocks/qa_hier_block2.py | 28 | ||||
-rw-r--r-- | gr-blocks/python/blocks/qa_vector_sink_source.py | 2 |
2 files changed, 15 insertions, 15 deletions
diff --git a/gr-blocks/python/blocks/qa_hier_block2.py b/gr-blocks/python/blocks/qa_hier_block2.py index 74533ad84b..e36838afee 100644 --- a/gr-blocks/python/blocks/qa_hier_block2.py +++ b/gr-blocks/python/blocks/qa_hier_block2.py @@ -74,7 +74,7 @@ class test_hier_block2(gr_unittest.TestCase): nop1 = blocks.nop(gr.sizeof_int) nop2 = blocks.nop(gr.sizeof_int) hblock.connect(nop1, hblock) - self.assertRaises(RuntimeError, + self.assertRaises(TypeError, lambda: hblock.connect(nop2, hblock)) def test_006_connect_invalid_src_port_neg(self): @@ -82,7 +82,7 @@ class test_hier_block2(gr_unittest.TestCase): gr.io_signature(1,1,gr.sizeof_int), gr.io_signature(1,1,gr.sizeof_int)) nop1 = blocks.nop(gr.sizeof_int) - self.assertRaises(RuntimeError, + self.assertRaises(TypeError, lambda: hblock.connect((hblock, -1), nop1)) def test_005_connect_invalid_src_port_exceeds(self): @@ -90,7 +90,7 @@ class test_hier_block2(gr_unittest.TestCase): gr.io_signature(1,1,gr.sizeof_int), gr.io_signature(1,1,gr.sizeof_int)) nop1 = blocks.nop(gr.sizeof_int) - self.assertRaises(RuntimeError, + self.assertRaises(TypeError, lambda: hblock.connect((hblock, 1), nop1)) def test_007_connect_invalid_dst_port_neg(self): @@ -99,7 +99,7 @@ class test_hier_block2(gr_unittest.TestCase): gr.io_signature(1,1,gr.sizeof_int)) nop1 = blocks.nop(gr.sizeof_int) nop2 = blocks.nop(gr.sizeof_int) - self.assertRaises(RuntimeError, + self.assertRaises(TypeError, lambda: hblock.connect(nop1, (nop2, -1))) def test_008_connect_invalid_dst_port_exceeds(self): @@ -108,7 +108,7 @@ class test_hier_block2(gr_unittest.TestCase): gr.io_signature(1,1,gr.sizeof_int)) nop1 = blocks.null_sink(gr.sizeof_int) nop2 = blocks.null_sink(gr.sizeof_int) - self.assertRaises(RuntimeError, + self.assertRaises(TypeError, lambda: hblock.connect(nop1, (nop2, 1))) def test_009_check_topology(self): @@ -144,7 +144,7 @@ class test_hier_block2(gr_unittest.TestCase): nop1 = blocks.nop(gr.sizeof_int) nop2 = blocks.nop(gr.sizeof_int) hblock.connect(hblock, nop1) - self.assertRaises(RuntimeError, + self.assertRaises(TypeError, lambda: hblock.disconnect(hblock, nop2)) def test_014_disconnect_input_neg(self): @@ -153,7 +153,7 @@ class test_hier_block2(gr_unittest.TestCase): gr.io_signature(1,1,gr.sizeof_int)) nop1 = blocks.nop(gr.sizeof_int) hblock.connect(hblock, nop1) - self.assertRaises(RuntimeError, + self.assertRaises(TypeError, lambda: hblock.disconnect((hblock, -1), nop1)) def test_015_disconnect_input_exceeds(self): @@ -162,7 +162,7 @@ class test_hier_block2(gr_unittest.TestCase): gr.io_signature(1,1,gr.sizeof_int)) nop1 = blocks.nop(gr.sizeof_int) hblock.connect(hblock, nop1) - self.assertRaises(RuntimeError, + self.assertRaises(TypeError, lambda: hblock.disconnect((hblock, 1), nop1)) def test_016_disconnect_output(self): @@ -180,7 +180,7 @@ class test_hier_block2(gr_unittest.TestCase): nop1 = blocks.nop(gr.sizeof_int) nop2 = blocks.nop(gr.sizeof_int) hblock.connect(nop1, hblock) - self.assertRaises(RuntimeError, + self.assertRaises(TypeError, lambda: hblock.disconnect(nop2, hblock)) def test_018_disconnect_output_neg(self): @@ -189,7 +189,7 @@ class test_hier_block2(gr_unittest.TestCase): gr.io_signature(1,1,gr.sizeof_int)) nop1 = blocks.nop(gr.sizeof_int) hblock.connect(hblock, nop1) - self.assertRaises(RuntimeError, + self.assertRaises(TypeError, lambda: hblock.disconnect(nop1, (hblock, -1))) def test_019_disconnect_output_exceeds(self): @@ -198,7 +198,7 @@ class test_hier_block2(gr_unittest.TestCase): gr.io_signature(1,1,gr.sizeof_int)) nop1 = blocks.nop(gr.sizeof_int) hblock.connect(nop1, hblock) - self.assertRaises(RuntimeError, + self.assertRaises(TypeError, lambda: hblock.disconnect(nop1, (hblock, 1))) def test_020_run(self): @@ -222,7 +222,7 @@ class test_hier_block2(gr_unittest.TestCase): blk = gr.hier_block2("block", gr.io_signature(1, 1, 1), gr.io_signature(1, 1, 1)) - self.assertRaises(RuntimeError, + self.assertRaises(TypeError, lambda: hblock.connect(blk)) def test_023_connect_single_twice(self): @@ -231,7 +231,7 @@ class test_hier_block2(gr_unittest.TestCase): gr.io_signature(0, 0, 0), gr.io_signature(0, 0, 0)) hblock.connect(blk) - self.assertRaises(RuntimeError, + self.assertRaises(TypeError, lambda: hblock.connect(blk)) def test_024_disconnect_single(self): @@ -247,7 +247,7 @@ class test_hier_block2(gr_unittest.TestCase): blk = gr.hier_block2("block", gr.io_signature(0, 0, 0), gr.io_signature(0, 0, 0)) - self.assertRaises(RuntimeError, + self.assertRaises(TypeError, lambda: hblock.disconnect(blk)) def test_026_run_single(self): diff --git a/gr-blocks/python/blocks/qa_vector_sink_source.py b/gr-blocks/python/blocks/qa_vector_sink_source.py index 103d815dd2..512e8f1df1 100644 --- a/gr-blocks/python/blocks/qa_vector_sink_source.py +++ b/gr-blocks/python/blocks/qa_vector_sink_source.py @@ -65,7 +65,7 @@ class test_vector_sink_source(gr_unittest.TestCase): # vector has sufficient size src_data = [float(x) for x in range(16)] expected_result = tuple(src_data) - self.assertRaises(RuntimeError, lambda : blocks.vector_source_f(src_data, False, 3)) + self.assertRaises(TypeError, lambda : blocks.vector_source_f(src_data, False, 3)) def test_004(self): # Test sending and receiving tagged streams |