[Git][NTPsec/ntpsec][wip-ntpq-peers-display] 3 commits: Deleted outdated comment in filtcooker.
Ian Bruene
gitlab at mg.gitlab.com
Sat Apr 1 00:46:35 UTC 2017
Ian Bruene pushed to branch wip-ntpq-peers-display at NTPsec / ntpsec
Commits:
34d8a7c2 by Ian Bruene at 2017-03-31T15:34:13-05:00
Deleted outdated comment in filtcooker.
- - - - -
d8676a14 by Ian Bruene at 2017-03-31T17:05:09-05:00
Added test for filtcooker.
- - - - -
d19dc0c6 by Ian Bruene at 2017-03-31T19:41:33-05:00
Added test for formatdigitsplit.
- - - - -
2 changed files:
- pylib/util.py
- tests/pylib/test_util.py
Changes:
=====================================
pylib/util.py
=====================================
--- a/pylib/util.py
+++ b/pylib/util.py
@@ -113,7 +113,6 @@ def filtcooker(data):
# Shift all values to the new unit
cooked = []
for part in floatyparts:
- # The scaled values aren't being saved for the formatter <<<<<<<<<
part = rescaleunit(part, mostcommon)
fmt = formatdigitsplit(part, 7)
temp = fmt % part
=====================================
tests/pylib/test_util.py
=====================================
--- a/tests/pylib/test_util.py
+++ b/tests/pylib/test_util.py
@@ -69,5 +69,26 @@ class TestPylibUtilMethods(unittest.TestCase):
self.assertEqual(ntp.util.oomsbetweenunits(2, 3),
3)
+ def test_filtcooker(self):
+ self.assertEqual(ntp.util.filtcooker(
+ "1.02 34.5 0.67835 -23.0 9 6.7 1.0 .1"),
+ " 1.02 34.5 0.67835 -23 9 6.7 1 0.1 ms")
+
+ def test_formatdigitsplit(self):
+ self.assertEqual(ntp.util.formatdigitsplit(10.0, 5),
+ "%5d")
+ self.assertEqual(ntp.util.formatdigitsplit(100.52, 5),
+ "%5.1f")
+ self.assertEqual(ntp.util.formatdigitsplit(10.123456789, 8),
+ "%8.5f")
+ self.assertEqual(ntp.util.formatdigitsplit(1.123456789, 8),
+ "%8.6f")
+ self.assertEqual(ntp.util.formatdigitsplit(0.123456789, 8),
+ "%8.6f")
+ self.assertEqual(ntp.util.formatdigitsplit(1.234, 10),
+ "%10.3f")
+ self.assertEqual(ntp.util.formatdigitsplit(-1.23456789, 6),
+ "%6.3f")
+
if __name__ == '__main__':
unittest.main()
View it on GitLab: https://gitlab.com/NTPsec/ntpsec/compare/91b41925c4640233788b0a57b08c6956c379d93b...d19dc0c66b8dea552bd8b0de0054b51850f60ea7
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.ntpsec.org/pipermail/vc/attachments/20170401/d4247a16/attachment.html>
More information about the vc
mailing list