summaryrefslogtreecommitdiff
path: root/gr-blocks/python
diff options
context:
space:
mode:
authorBen Reynwar <ben@reynwar.net>2013-05-19 02:55:33 -0700
committerBen Reynwar <ben@reynwar.net>2013-05-19 02:55:33 -0700
commitbb01988e75d50d82cbb44c1a49c86c1d08f05665 (patch)
tree0528dac14476d37f2cde7374a8fcb3428f879c69 /gr-blocks/python
parente4f0319eced22c112f7e6a4cc45bc2036d285332 (diff)
parent0fa219774dcf9141ae91204f948c029b05673f3f (diff)
Merged in next_docs branch.
Diffstat (limited to 'gr-blocks/python')
-rw-r--r--gr-blocks/python/blocks/__init__.py3
-rwxr-xr-xgr-blocks/python/blocks/qa_keep_one_in_n.py1
-rw-r--r--gr-blocks/python/qa_message_tags.py4
-rwxr-xr-xgr-blocks/python/qa_repack_bits_bb.py4
-rwxr-xr-xgr-blocks/python/qa_tag_gate.py47
-rwxr-xr-xgr-blocks/python/qa_tagged_stream_mux.py8
6 files changed, 57 insertions, 10 deletions
diff --git a/gr-blocks/python/blocks/__init__.py b/gr-blocks/python/blocks/__init__.py
index 4274ac54ab..b7ba794ea2 100644
--- a/gr-blocks/python/blocks/__init__.py
+++ b/gr-blocks/python/blocks/__init__.py
@@ -20,8 +20,7 @@
#
'''
-This is the gr-blocks package. This package provides GNU Radio
-processing blocks common to many flowgraphs.
+Processing blocks common to many flowgraphs.
'''
import os
diff --git a/gr-blocks/python/blocks/qa_keep_one_in_n.py b/gr-blocks/python/blocks/qa_keep_one_in_n.py
index d8251fe611..2a5d936cce 100755
--- a/gr-blocks/python/blocks/qa_keep_one_in_n.py
+++ b/gr-blocks/python/blocks/qa_keep_one_in_n.py
@@ -36,6 +36,7 @@ class test_keep_one_in_n(gr_unittest.TestCase):
src = blocks.vector_source_b(src_data);
op = blocks.keep_one_in_n(gr.sizeof_char, 5)
dst = blocks.vector_sink_b()
+ print "HERE"
self.tb.connect(src, op, dst)
self.tb.run()
self.assertEqual(dst.data(), expected_data)
diff --git a/gr-blocks/python/qa_message_tags.py b/gr-blocks/python/qa_message_tags.py
index 0ab857b1aa..952c699455 100644
--- a/gr-blocks/python/qa_message_tags.py
+++ b/gr-blocks/python/qa_message_tags.py
@@ -7,8 +7,8 @@ class test_message_tags (gr_unittest.TestCase):
def test_1 (self):
data = ('hello', 'you', 'there')
- tx_msgq = gr.msg_queue ()
- rx_msgq = gr.msg_queue ()
+ tx_msgq = gr.msg_queue()
+ rx_msgq = gr.msg_queue()
for d in data:
tx_msgq.insert_tail(gr.message_from_string(d))
tb = gr.top_block()
diff --git a/gr-blocks/python/qa_repack_bits_bb.py b/gr-blocks/python/qa_repack_bits_bb.py
index 9da6cf26c6..209b6e1324 100755
--- a/gr-blocks/python/qa_repack_bits_bb.py
+++ b/gr-blocks/python/qa_repack_bits_bb.py
@@ -79,7 +79,7 @@ class qa_repack_bits_bb (gr_unittest.TestCase):
k = 8
l = 3
tag_name = "len"
- tag = gr.gr_tag_t()
+ tag = gr.tag_t()
tag.offset = 0
tag.key = pmt.string_to_symbol(tag_name)
tag.value = pmt.from_long(len(src_data))
@@ -104,7 +104,7 @@ class qa_repack_bits_bb (gr_unittest.TestCase):
k = 3
l = 8
tag_name = "len"
- tag = gr.gr_tag_t()
+ tag = gr.tag_t()
tag.offset = 0
tag.key = pmt.string_to_symbol(tag_name)
tag.value = pmt.from_long(len(src_data))
diff --git a/gr-blocks/python/qa_tag_gate.py b/gr-blocks/python/qa_tag_gate.py
new file mode 100755
index 0000000000..1999f7a35d
--- /dev/null
+++ b/gr-blocks/python/qa_tag_gate.py
@@ -0,0 +1,47 @@
+#!/usr/bin/env python
+#
+# Copyright 2013 <+YOU OR YOUR COMPANY+>.
+#
+# This is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3, or (at your option)
+# any later version.
+#
+# This software is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this software; see the file COPYING. If not, write to
+# the Free Software Foundation, Inc., 51 Franklin Street,
+# Boston, MA 02110-1301, USA.
+#
+
+from gnuradio import gr, gr_unittest
+import pmt
+import blocks_swig as blocks
+
+
+class qa_tag_gate (gr_unittest.TestCase):
+
+ def setUp (self):
+ self.tb = gr.top_block ()
+
+ def tearDown (self):
+ self.tb = None
+
+ def test_001_t (self):
+ tag = gr.tag_t()
+ tag.key = pmt.string_to_symbol('key')
+ tag.value = pmt.from_long(42)
+ tag.offset = 0
+ src = blocks.vector_source_f(range(20), False, 1, (tag,))
+ gate = blocks.tag_gate(gr.sizeof_float, False)
+ sink = blocks.vector_sink_f()
+ self.tb.run ()
+ self.assertEqual(len(sink.tags()), 0)
+
+if __name__ == '__main__':
+ gr_unittest.run(qa_tag_gate, "qa_tag_gate.xml")
+
diff --git a/gr-blocks/python/qa_tagged_stream_mux.py b/gr-blocks/python/qa_tagged_stream_mux.py
index 1759c44623..e9c3343000 100755
--- a/gr-blocks/python/qa_tagged_stream_mux.py
+++ b/gr-blocks/python/qa_tagged_stream_mux.py
@@ -27,7 +27,7 @@ import numpy
def make_len_tags(tupl, key):
tags = []
- tag = gr.gr_tag_t()
+ tag = gr.tag_t()
tag.key = pmt.string_to_symbol(key)
n_read = 0
for element in tupl:
@@ -38,7 +38,7 @@ def make_len_tags(tupl, key):
return tags
def make_len_tag(offset, key, value):
- tag = gr.gr_tag_t()
+ tag = gr.tag_t()
tag.offset = offset
tag.key = pmt.string_to_symbol(key)
tag.value = pmt.to_pmt(value)
@@ -73,11 +73,11 @@ class qa_tagged_stream_mux (gr_unittest.TestCase):
make_len_tag(5, tagname, 3),
make_len_tag(8, tagname, 1)
)
- test_tag_0 = gr.gr_tag_t()
+ test_tag_0 = gr.tag_t()
test_tag_0.key = pmt.string_to_symbol('spam')
test_tag_0.offset = 4 # On the second '1'
test_tag_0.value = pmt.to_pmt(42)
- test_tag_1 = gr.gr_tag_t()
+ test_tag_1 = gr.tag_t()
test_tag_1.key = pmt.string_to_symbol('eggs')
test_tag_1.offset = 3 # On the first '3' of the 2nd stream
test_tag_1.value = pmt.to_pmt(23)