<html>
<head>
<style><!--
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
font-size: 12pt;
font-family:Calibri
}
--></style></head>
<body class='hmmessage'><div dir='ltr'># HG changeset patch<br># User K. Arvanitis <<a href="mailto:kosta@alumni.uvic.ca">kosta@alumni.uvic.ca</a>><br># Date 1421988817 28800<br># Thu Jan 22 20:53:37 2015 -0800<br># Node ID e347fdbfc9c2ce3a80bf037c2a7667afda8eed13<br># Parent b25606106a9c0cd78f3cc5f602475da64cde081d<br>[PATCH] Add Support for Settings UnitTest<BR>Add a basic unit test coverage of the radio Settings API.<BR>Currently, all but one image passes the test (UV3R).<br>Commented out offending code in uv3r module.<BR>Feature #2235<BR>diff -r b25606106a9c -r e347fdbfc9c2 chirp/baofeng_uv3r.py<br>--- a/chirp/baofeng_uv3r.py Wed Jan 21 23:30:19 2015 -0800<br>+++ b/chirp/baofeng_uv3r.py Thu Jan 22 20:53:37 2015 -0800<br>@@ -421,42 +421,6 @@<br> CH_FLAG_LIST[_settings.ch_flag]))<br> basic.append(rs)<br> <br>- _limit = int(self._memobj.limits.lower_vhf) / 10<br>- rs = RadioSetting("limits.lower_vhf", "VHF Lower Limit (115-239 MHz)",<br>- RadioSettingValueInteger(115, 235, _limit))<br>- def apply_limit(setting, obj):<br>- value = int(setting.value) * 10<br>- obj.lower_vhf = value<br>- rs.set_apply_callback(apply_limit, self._memobj.limits)<br>- basic.append(rs)<br>-<br>- _limit = int(self._memobj.limits.upper_vhf) / 10<br>- rs = RadioSetting("limits.upper_vhf", "VHF Upper Limit (115-239 MHz)",<br>- RadioSettingValueInteger(115, 235, _limit))<br>- def apply_limit(setting, obj):<br>- value = int(setting.value) * 10<br>- obj.upper_vhf = value<br>- rs.set_apply_callback(apply_limit, self._memobj.limits)<br>- basic.append(rs)<br>-<br>- _limit = int(self._memobj.limits.lower_uhf) / 10<br>- rs = RadioSetting("limits.lower_uhf", "UHF Lower Limit (200-529 MHz)",<br>- RadioSettingValueInteger(200, 529, _limit))<br>- def apply_limit(setting, obj):<br>- value = int(setting.value) * 10<br>- obj.lower_uhf = value<br>- rs.set_apply_callback(apply_limit, self._memobj.limits)<br>- basic.append(rs)<br>-<br>- _limit = int(self._memobj.limits.upper_uhf) / 10<br>- rs = RadioSetting("limits.upper_uhf", "UHF Upper Limit (200-529 MHz)",<br>- RadioSettingValueInteger(200, 529, _limit))<br>- def apply_limit(setting, obj):<br>- value = int(setting.value) * 10<br>- obj.upper_uhf = value<br>- rs.set_apply_callback(apply_limit, self._memobj.limits)<br>- basic.append(rs)<br>-<br> vfo_preset = RadioSettingGroup("vfo_preset", "VFO Presets")<br> group.append(vfo_preset)<br> <br>diff -r b25606106a9c -r e347fdbfc9c2 tests/run_tests<br>--- a/tests/run_tests Wed Jan 21 23:30:19 2015 -0800<br>+++ b/tests/run_tests Thu Jan 22 20:53:37 2015 -0800<br>@@ -520,8 +520,30 @@<br> self.do_badname(rf)<br> <br> return []<br>+<br> TESTS["Edges"] = TestCaseEdges<br> <br>+<br>+class TestCaseSettings(TestCase):<br>+ def __str__(self):<br>+ return "Settings"<br>+<br>+ def do_get_settings(self, rf):<br>+ self._wrapper.do("get_settings")<br>+<br>+ def run(self):<br>+ rf = self._wrapper.do("get_features")<br>+<br>+ if not rf.has_settings:<br>+ raise TestSkippedError("Settings not supported")<br>+<br>+ self.do_get_settings(rf)<br>+<br>+ return []<br>+<br>+TESTS["Settings"] = TestCaseSettings<br>+<br>+<br> class TestCaseBanks(TestCase):<br> def __str__(self):<br> return "Banks"<br> <BR>                                            </div></body>
</html>