diff options
author | mormj <mormjb@gmail.com> | 2020-10-30 10:59:50 -0400 |
---|---|---|
committer | Marcus Müller <marcus@hostalia.de> | 2020-10-30 17:52:53 +0100 |
commit | 7a0948ba85758fba1cc3858ef99bfa600dcc7416 (patch) | |
tree | 610d7f9d773a193562def6df2d4b50f1bb3b3f86 /gr-blocks/python/blocks/qa_ctrlport_probes.py | |
parent | 12192ee7d58de95ddca35a3e93bfc172bdb5c820 (diff) |
qa: run autopep8 formatting on qa python files
find ./ -iname qa*.py | xargs autopep8 --in-place -a -a
mostly formats whitespace and gets rid of trailing semicolons
Diffstat (limited to 'gr-blocks/python/blocks/qa_ctrlport_probes.py')
-rw-r--r-- | gr-blocks/python/blocks/qa_ctrlport_probes.py | 59 |
1 files changed, 34 insertions, 25 deletions
diff --git a/gr-blocks/python/blocks/qa_ctrlport_probes.py b/gr-blocks/python/blocks/qa_ctrlport_probes.py index edaabcfc34..33b5a02e9b 100644 --- a/gr-blocks/python/blocks/qa_ctrlport_probes.py +++ b/gr-blocks/python/blocks/qa_ctrlport_probes.py @@ -9,12 +9,18 @@ # -import sys, time, random, numpy +import sys +import time +import random +import numpy from gnuradio import gr, gr_unittest, blocks -import os, struct, re +import os +import struct +import re from gnuradio.ctrlport.GNURadioControlPortClient import GNURadioControlPortClient + class test_ctrlport_probes(gr_unittest.TestCase): def setUp(self): @@ -25,17 +31,16 @@ class test_ctrlport_probes(gr_unittest.TestCase): self.tb = None def test_001(self): - data = list(range(1,9)) + data = list(range(1, 9)) self.src = blocks.vector_source_c(data, True) - self.probe = blocks.ctrlport_probe2_c("samples","Complex", + self.probe = blocks.ctrlport_probe2_c("samples", "Complex", len(data), gr.DISPNULL) probe_name = self.probe.alias() self.tb.connect(self.src, self.probe) self.tb.start() - # Probes return complex values as list of floats with re, im # Imaginary parts of this data set are 0. expected_result = [1, 2, 3, 4, @@ -51,7 +56,8 @@ class test_ctrlport_probes(gr_unittest.TestCase): # Initialize a simple ControlPort client from endpoint from gnuradio.ctrlport.GNURadioControlPortClient import GNURadioControlPortClient - radiosys = GNURadioControlPortClient(hostname, portnum, rpcmethod='thrift') + radiosys = GNURadioControlPortClient( + hostname, portnum, rpcmethod='thrift') radio = radiosys.client # Get all exported knobs @@ -67,19 +73,18 @@ class test_ctrlport_probes(gr_unittest.TestCase): self.tb.stop() self.tb.wait() - def test_002(self): - data = list(range(1,9)) + data = list(range(1, 9)) self.src = blocks.vector_source_f(data, True) - self.probe = blocks.ctrlport_probe2_f("samples","Floats", + self.probe = blocks.ctrlport_probe2_f("samples", "Floats", len(data), gr.DISPNULL) probe_name = self.probe.alias() self.tb.connect(self.src, self.probe) self.tb.start() - expected_result = [1, 2, 3, 4, 5, 6, 7, 8,] + expected_result = [1, 2, 3, 4, 5, 6, 7, 8, ] # Make sure we have time for flowgraph to run time.sleep(0.1) @@ -91,7 +96,8 @@ class test_ctrlport_probes(gr_unittest.TestCase): # Initialize a simple ControlPort client from endpoint from gnuradio.ctrlport.GNURadioControlPortClient import GNURadioControlPortClient - radiosys = GNURadioControlPortClient(hostname, portnum, rpcmethod='thrift') + radiosys = GNURadioControlPortClient( + hostname, portnum, rpcmethod='thrift') radio = radiosys.client # Get all exported knobs @@ -108,17 +114,17 @@ class test_ctrlport_probes(gr_unittest.TestCase): self.tb.wait() def test_003(self): - data = list(range(1,9)) + data = list(range(1, 9)) self.src = blocks.vector_source_i(data, True) - self.probe = blocks.ctrlport_probe2_i("samples","Integers", + self.probe = blocks.ctrlport_probe2_i("samples", "Integers", len(data), gr.DISPNULL) probe_name = self.probe.alias() self.tb.connect(self.src, self.probe) self.tb.start() - expected_result = [1, 2, 3, 4, 5, 6, 7, 8,] + expected_result = [1, 2, 3, 4, 5, 6, 7, 8, ] # Make sure we have time for flowgraph to run time.sleep(0.1) @@ -130,7 +136,8 @@ class test_ctrlport_probes(gr_unittest.TestCase): # Initialize a simple ControlPort client from endpoint from gnuradio.ctrlport.GNURadioControlPortClient import GNURadioControlPortClient - radiosys = GNURadioControlPortClient(hostname, portnum, rpcmethod='thrift') + radiosys = GNURadioControlPortClient( + hostname, portnum, rpcmethod='thrift') radio = radiosys.client # Get all exported knobs @@ -146,19 +153,18 @@ class test_ctrlport_probes(gr_unittest.TestCase): self.tb.stop() self.tb.wait() - def test_004(self): - data = list(range(1,9)) + data = list(range(1, 9)) self.src = blocks.vector_source_s(data, True) - self.probe = blocks.ctrlport_probe2_s("samples","Shorts", + self.probe = blocks.ctrlport_probe2_s("samples", "Shorts", len(data), gr.DISPNULL) probe_name = self.probe.alias() self.tb.connect(self.src, self.probe) self.tb.start() - expected_result = [1, 2, 3, 4, 5, 6, 7, 8,] + expected_result = [1, 2, 3, 4, 5, 6, 7, 8, ] # Make sure we have time for flowgraph to run time.sleep(0.1) @@ -170,7 +176,8 @@ class test_ctrlport_probes(gr_unittest.TestCase): # Initialize a simple ControlPort client from endpoint from gnuradio.ctrlport.GNURadioControlPortClient import GNURadioControlPortClient - radiosys = GNURadioControlPortClient(hostname, portnum, rpcmethod='thrift') + radiosys = GNURadioControlPortClient( + hostname, portnum, rpcmethod='thrift') radio = radiosys.client # Get all exported knobs @@ -187,17 +194,17 @@ class test_ctrlport_probes(gr_unittest.TestCase): self.tb.wait() def test_005(self): - data = list(range(1,9)) + data = list(range(1, 9)) self.src = blocks.vector_source_b(data, True) - self.probe = blocks.ctrlport_probe2_b("samples","Bytes", + self.probe = blocks.ctrlport_probe2_b("samples", "Bytes", len(data), gr.DISPNULL) probe_name = self.probe.alias() self.tb.connect(self.src, self.probe) self.tb.start() - expected_result = [1, 2, 3, 4, 5, 6, 7, 8,] + expected_result = [1, 2, 3, 4, 5, 6, 7, 8, ] # Make sure we have time for flowgraph to run time.sleep(0.1) @@ -209,7 +216,8 @@ class test_ctrlport_probes(gr_unittest.TestCase): # Initialize a simple ControlPort client from endpoint from gnuradio.ctrlport.GNURadioControlPortClient import GNURadioControlPortClient - radiosys = GNURadioControlPortClient(hostname, portnum, rpcmethod='thrift') + radiosys = GNURadioControlPortClient( + hostname, portnum, rpcmethod='thrift') radio = radiosys.client # Get all exported knobs @@ -218,7 +226,7 @@ class test_ctrlport_probes(gr_unittest.TestCase): # Get data in probe, which might be offset; find the # beginning and unwrap. result = ret[name].value - result = list(struct.unpack(len(result)*'b', result)) + result = list(struct.unpack(len(result) * 'b', result)) i = result.index(1) result = result[i:] + result[0:i] self.assertEqual(expected_result, result) @@ -226,5 +234,6 @@ class test_ctrlport_probes(gr_unittest.TestCase): self.tb.stop() self.tb.wait() + if __name__ == '__main__': gr_unittest.run(test_ctrlport_probes) |