[Git][NTPsec/ntpsec][master] The start of a python test suite

Eric S. Raymond gitlab at mg.gitlab.com
Tue Dec 6 05:45:38 UTC 2016


Eric S. Raymond pushed to branch master at NTPsec / ntpsec


Commits:
3f69919c by Matt Selsky at 2016-12-06T00:43:19-05:00
The start of a python test suite

- - - - -


1 changed file:

- + tests/pylib/test_util.py


Changes:

=====================================
tests/pylib/test_util.py
=====================================
--- /dev/null
+++ b/tests/pylib/test_util.py
@@ -0,0 +1,16 @@
+import unittest
+import ntp.util
+
+class TestPylibUtilMethods(unittest.TestCase):
+
+    def test_rfc3339(self):
+        self.assertEqual(ntp.util.rfc3339(1480999786), '2016-12-06T04:49:46Z')
+        self.assertEqual(ntp.util.rfc3339(1480999786.5), '2016-12-06T04:49:46.5Z')
+
+    def test_portsplit(self):
+        self.assertEqual(ntp.util.portsplit("host.invalid"), ("host.invalid", ""))
+        self.assertEqual(ntp.util.portsplit("host.invalid:123"), ("host.invalid", ":123"))
+        self.assertEqual(ntp.util.portsplit("[0000:1111:2222:3333:4444:5555:6666:7777]:123"), ("0000:1111:2222:3333:4444:5555:6666:7777", ":123"))
+
+if __name__ == '__main__':
+    unittest.main()



View it on GitLab: https://gitlab.com/NTPsec/ntpsec/commit/3f69919cefc3bc25ce61d3f27ad676748510dbae
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ntpsec.org/pipermail/vc/attachments/20161206/9973dc35/attachment.html>


More information about the vc mailing list