/[storm]/storm/org/nongnu/storm/BlockId.test
ViewVC logotype

Diff of /storm/org/nongnu/storm/BlockId.test

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.10 by tuukkah, Wed Apr 23 17:27:47 2003 UTC revision 1.11 by tuukkah, Fri Apr 25 12:46:34 2003 UTC
# Line 40  uri_3 = ("urn:x-storm:1.0:text/plain," Line 40  uri_3 = ("urn:x-storm:1.0:text/plain,"
40  lower_3 = uri_3.lower()  lower_3 = uri_3.lower()
41  data_3 = 1025 * 'A'  data_3 = 1025 * 'A'
42    
43    contenttest = ("urn:x-storm:1.0:%s,"
44                   "u7uu5zpmkoeykkwhxd4unlqycc36gvl7."
45                   "jtlcbiy2r6gfsznbgj42yzqbqk4ti373bqs5qyy")
46    
47  def testConstructor():  def testConstructor():
48      id = BlockId(uri_1)      id = BlockId(uri_1)
# Line 84  def testMalformed(): Line 87  def testMalformed():
87      else: assert 0      else: assert 0
88  # XXX test other wrong lengths too  # XXX test other wrong lengths too
89    
90    def testContentType():
91        """Malformed content types must throw exceptions"""
92    
93        BlockId(contenttest % 'text/html')
94        BlockId(contenttest % 'a/a')
95        BlockId(contenttest % 'x/x')
96    
97        try: BlockId(contenttest % '/html')
98        except java.lang.IllegalArgumentException: pass
99        else: assert 0
100    
101        try: BlockId(contenttest % 'text/')
102        except java.lang.IllegalArgumentException: pass
103        else: assert 0
104    
105        try: BlockId(contenttest % '/')
106        except java.lang.IllegalArgumentException: pass
107        else: assert 0
108    
109        try: BlockId(contenttest % 'text/html/myextension')
110        except java.lang.IllegalArgumentException: pass
111        else: assert 0
112    
113        try: BlockId(contenttest % 'mytype')
114        except java.lang.IllegalArgumentException: pass
115        else: assert 0
116    
117    
118  def testSpaces():  def testSpaces():
119      """Spaces in content types must throw exceptions"""      """Spaces in content types must throw exceptions"""
     str = ("urn:x-storm:1.0:%s,"  
            "u7uu5zpmkoeykkwhxd4unlqycc36gvl7."  
            "jtlcbiy2r6gfsznbgj42yzqbqk4ti373bqs5qyy")  
120    
121      BlockId(str % 'text/plain;charset=UTF-8')      BlockId(contenttest % 'text/plain;charset=UTF-8')
122    
123      try: BlockId(str % 'text/plain; charset=UTF-8')      try: BlockId(contenttest % 'text/plain; charset=UTF-8')
124      except java.lang.IllegalArgumentException: pass      except java.lang.IllegalArgumentException: pass
125      else: assert 0      else: assert 0
126    

Legend:
Removed from v.1.10  
changed lines
  Added in v.1.11

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26