Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(5)

Side by Side Diff: third_party/twisted_8_1/twisted/test/test_abstract.py

Issue 12261012: Remove third_party/twisted_8_1 (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/build
Patch Set: Created 7 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 # Copyright (c) 2007 Twisted Matrix Laboratories.
2 # See LICENSE for details.
3
4 """
5 Tests for generic file descriptor based reactor support code.
6 """
7
8 from twisted.trial.unittest import TestCase
9
10 from twisted.internet.abstract import isIPAddress
11
12
13 class AddressTests(TestCase):
14 """
15 Tests for address-related functionality.
16 """
17 def test_decimalDotted(self):
18 """
19 L{isIPAddress} should return C{True} for any decimal dotted
20 representation of an IPv4 address.
21 """
22 self.assertTrue(isIPAddress('0.1.2.3'))
23 self.assertTrue(isIPAddress('252.253.254.255'))
24
25
26 def test_shortDecimalDotted(self):
27 """
28 L{isIPAddress} should return C{False} for a dotted decimal
29 representation with fewer or more than four octets.
30 """
31 self.assertFalse(isIPAddress('0'))
32 self.assertFalse(isIPAddress('0.1'))
33 self.assertFalse(isIPAddress('0.1.2'))
34 self.assertFalse(isIPAddress('0.1.2.3.4'))
35
36
37 def test_invalidLetters(self):
38 """
39 L{isIPAddress} should return C{False} for any non-decimal dotted
40 representation including letters.
41 """
42 self.assertFalse(isIPAddress('a.2.3.4'))
43 self.assertFalse(isIPAddress('1.b.3.4'))
44
45
46 def test_invalidPunctuation(self):
47 """
48 L{isIPAddress} should return C{False} for a string containing
49 strange punctuation.
50 """
51 self.assertFalse(isIPAddress(','))
52 self.assertFalse(isIPAddress('1,2'))
53 self.assertFalse(isIPAddress('1,2,3'))
54 self.assertFalse(isIPAddress('1.,.3,4'))
55
56
57 def test_emptyString(self):
58 """
59 L{isIPAddress} should return C{False} for the empty string.
60 """
61 self.assertFalse(isIPAddress(''))
62
63
64 def test_invalidNegative(self):
65 """
66 L{isIPAddress} should return C{False} for negative decimal values.
67 """
68 self.assertFalse(isIPAddress('-1'))
69 self.assertFalse(isIPAddress('1.-2'))
70 self.assertFalse(isIPAddress('1.2.-3'))
71 self.assertFalse(isIPAddress('1.2.-3.4'))
72
73
74 def test_invalidPositive(self):
75 """
76 L{isIPAddress} should return C{False} for a string containing
77 positive decimal values greater than 255.
78 """
79 self.assertFalse(isIPAddress('256.0.0.0'))
80 self.assertFalse(isIPAddress('0.256.0.0'))
81 self.assertFalse(isIPAddress('0.0.256.0'))
82 self.assertFalse(isIPAddress('0.0.0.256'))
83 self.assertFalse(isIPAddress('256.256.256.256'))
OLDNEW
« no previous file with comments | « third_party/twisted_8_1/twisted/test/stdio_test_writeseq.py ('k') | third_party/twisted_8_1/twisted/test/test_adbapi.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698