summaryrefslogtreecommitdiff
path: root/gr-blocks/python
diff options
context:
space:
mode:
authorAndrej Rode <mail@andrejro.de>2019-03-30 11:17:20 +0100
committerAndrej Rode <mail@andrejro.de>2019-03-30 16:02:01 +0100
commitd6e217cbc00ec0333ba030ab2d84c31b7dbb77d5 (patch)
treee9b2fbb1bc4b5c6392aa36b091650c0d73c3d2ad /gr-blocks/python
parent8ecdef41e47641f820fff73e0ad11c0890544b71 (diff)
qa: first copy tags from the vector sink before indexing
Diffstat (limited to 'gr-blocks/python')
-rw-r--r--gr-blocks/python/blocks/qa_skiphead.py9
-rwxr-xr-xgr-blocks/python/blocks/qa_tag_share.py20
2 files changed, 16 insertions, 13 deletions
diff --git a/gr-blocks/python/blocks/qa_skiphead.py b/gr-blocks/python/blocks/qa_skiphead.py
index 36f3f3e797..2370978d8c 100644
--- a/gr-blocks/python/blocks/qa_skiphead.py
+++ b/gr-blocks/python/blocks/qa_skiphead.py
@@ -123,13 +123,14 @@ class test_skiphead(gr_unittest.TestCase):
self.tb.connect(src1, op, dst1)
self.tb.run()
dst_data = dst1.data()
+ dst_tags = dst1.tags()
self.assertEqual(expected_result, dst_data)
- self.assertEqual(dst1.tags()[0].offset, 25, "Tag offset is incorrect")
- self.assertEqual(len(dst1.tags()), 1, "Wrong number of tags received")
+ self.assertEqual(dst_tags[0].offset, 25, "Tag offset is incorrect")
+ self.assertEqual(len(dst_tags), 1, "Wrong number of tags received")
self.assertEqual(pmt.to_python(
- dst1.tags()[0].key), "baz", "Tag key is incorrect")
+ dst_tags[0].key), "baz", "Tag key is incorrect")
self.assertEqual(pmt.to_python(
- dst1.tags()[0].value), "qux", "Tag value is incorrect")
+ dst_tags[0].value), "qux", "Tag value is incorrect")
if __name__ == '__main__':
gr_unittest.run(test_skiphead, "test_skiphead.xml")
diff --git a/gr-blocks/python/blocks/qa_tag_share.py b/gr-blocks/python/blocks/qa_tag_share.py
index 3fff02ff66..4f5a7117c5 100755
--- a/gr-blocks/python/blocks/qa_tag_share.py
+++ b/gr-blocks/python/blocks/qa_tag_share.py
@@ -1,25 +1,25 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
-#
+#
# Copyright 2017 Free Software Foundation, Inc.
-#
+#
# This file is part of GNU Radio
-#
+#
# GNU Radio 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.
-#
+#
# GNU Radio 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 GNU Radio; 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
from gnuradio import blocks
@@ -63,9 +63,11 @@ class qa_tag_share(gr_unittest.TestCase):
self.tb.run()
self.assertEqual(len(sink.tags()), 1)
- self.assertEqual(pmt.to_python(sink.tags()[0].key), tag_key)
- self.assertEqual(pmt.to_python(sink.tags()[0].value), tag_value)
- self.assertEqual(sink.tags()[0].offset, tag_offset)
+ # print(sink.tags())
+ received_tag = sink.tags()[0]
+ self.assertEqual(pmt.to_python(received_tag.key), tag_key)
+ self.assertEqual(pmt.to_python(received_tag.value), tag_value)
+ self.assertEqual(received_tag.offset, tag_offset)
self.assertEqual(sink.data(), sink_data)