[chirp_devel] [uvr50] New model: Quansheng UV-R50 (fixes #6129)

Dan Smith
Wed Oct 7 12:28:33 PDT 2020


> I hit a small issue in TestCopyAll as one of the test cases involves a channel with a name containing spaces, and this radio doesn't know how to encode a space in a channel name as far as I can tell, so I added support in that test to ignore this narrow class of failures. I'm happy to change for another approach if it is preferred.

Thanks, this is indeed a bug in the test, but I think we should solve it a different way.

> diff --git a/tests/run_tests.py b/tests/run_tests.py
> --- a/tests/run_tests.py
> +++ b/tests/run_tests.py
> @@ -306,8 +306,17 @@
>              self._wrapper.do("set_memory", dst_mem)
>              ret_mem = self._wrapper.do("get_memory", dst_number)
>  
> +            # Some radios may not support all characters used in
> +            # channel names in the test data. If that's the case,
> +            # ignore the name field for this test entry.
> +            ignore = None
> +            for c in dst_mem.name:
> +                if c not in dst_rf.valid_characters:
> +                    ignore = ['name']
> +                    break
> +
>              try:
> -                self.compare_mem(dst_mem, ret_mem)
> +                self.compare_mem(dst_mem, ret_mem, ignore=ignore)
>              except TestFailedError, e:

What you have here just makes us ignore any problems with the name, which may be more serious than just the spaces. Really, we should pre-filter the name in the source memory and expect that value instead. Can you do something like:

  ret_mem.name = ''.join(x for x in ret_mem.name if x in dst_rf.valid_characters)

? Then we should get a valid result from compare_mem().

Thanks!

--Dan


More information about the chirp_devel mailing list