90 |
def testContentType(): |
def testContentType(): |
91 |
"""Malformed content types must throw exceptions""" |
"""Malformed content types must throw exceptions""" |
92 |
|
|
93 |
BlockId(contenttest % 'text/html') |
for ct in ['text/html', |
94 |
BlockId(contenttest % 'a/a') |
'a/a', |
95 |
BlockId(contenttest % 'x/x') |
'x/x']: |
96 |
|
BlockId(contenttest % ct) |
97 |
try: BlockId(contenttest % '/html') |
|
98 |
except java.lang.IllegalArgumentException: pass |
for ct in ['/html', |
99 |
else: assert 0 |
'text/', |
100 |
|
'/', |
101 |
try: BlockId(contenttest % 'text/') |
'text/html/myextension', |
102 |
except java.lang.IllegalArgumentException: pass |
'mytype']: |
103 |
else: assert 0 |
try: BlockId(contenttest % ct) |
104 |
|
except java.lang.IllegalArgumentException: pass |
105 |
try: BlockId(contenttest % '/') |
else: assert 0 |
|
except java.lang.IllegalArgumentException: pass |
|
|
else: assert 0 |
|
|
|
|
|
try: BlockId(contenttest % 'text/html/myextension') |
|
|
except java.lang.IllegalArgumentException: pass |
|
|
else: assert 0 |
|
|
|
|
|
try: BlockId(contenttest % 'mytype') |
|
|
except java.lang.IllegalArgumentException: pass |
|
|
else: assert 0 |
|
106 |
|
|
107 |
|
|
108 |
def testSpaces(): |
def testSpaces(): |