[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[tor-commits] [flashproxy/master] Add format_addr tests with an empty string for the host part.
commit 597d0bb6271d64ca0c3f5a26155e537ae865573b
Author: David Fifield <david@xxxxxxxxxxxxxxx>
Date: Sat Feb 8 12:45:53 2014 -0800
Add format_addr tests with an empty string for the host part.
Since 5d3ae963fa6b514c28e5ad37e60a165d82526831, (addr, port) pairs can
have "" as well as None in the addr part.
One of the new tests is failing for me on OS X. The expected behavior
that I see on GNU/Linux is
format_addr((None, 1234)) --> ":1234"
format_addr(("", 1234)) --> ":1234"
On OS X, it is
format_addr((None, 1234)) --> ":1234"
format_addr(("", 1234)) --> "[]:1234"
---
flashproxy/test/test_util.py | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/flashproxy/test/test_util.py b/flashproxy/test/test_util.py
index 3529d23..1debcfd 100644
--- a/flashproxy/test/test_util.py
+++ b/flashproxy/test/test_util.py
@@ -60,6 +60,15 @@ class FormatAddrTest(unittest.TestCase):
def test_none_invalid(self):
self.assertRaises(ValueError, format_addr, (None, "string"))
+ def test_empty_none(self):
+ self.assertRaises(ValueError, format_addr, ("", None))
+
+ def test_empty_port(self):
+ self.assertEqual(format_addr(("", 1234)), ":1234")
+
+ def test_empty_invalid(self):
+ self.assertRaises(ValueError, format_addr, ("", "string"))
+
def test_ipv4_none(self):
self.assertEqual(format_addr(("1.2.3.4", None)), "1.2.3.4")
_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits