Skip to content

Commit ab20193

Browse files
author
lantis63
committed
Changed an assertTrue in the tokenizer unittest to assertEquals because assertTrue isn't available in the default unittest framework for python2.3. Also added the frozenset, set imports for parser.py since it uses frozenset. python2.3 now passes all the tests.
--HG-- extra : convert_revision : svn%3Aacbfec75-9323-0410-a652-858a13e371e0/trunk%40334
1 parent 679f808 commit ab20193

5 files changed

Lines changed: 11 additions & 4 deletions

File tree

src/constants.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import string
22

33
try:
4-
type(frozenset)
4+
frozenset
55
except NameError:
66
#Import from the sets module for python 2.3
77
from sets import Set as set

src/parser.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
try:
2+
frozenset
3+
except NameError:
4+
#Import from the sets module for python 2.3
5+
from sets import Set as set
6+
from sets import ImmutableSet as frozenset
7+
18
import tokenizer
29

310
import utils

src/tokenizer.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
try:
2-
type(frozenset)
2+
frozenset
33
except NameError:
44
#Import from the sets module for python 2.3
55
from sets import Set as set

src/utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
try:
2-
type(frozenset)
2+
frozenset
33
except NameError:
44
#Import from the sets module for python 2.3
55
from sets import Set as set

tests/test_tokenizer.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ def runTokenizerTest(self, input, output):
8787
tokens = concatenateCharacterTokens(tokens)
8888
errorMsg = "\n".join(["\n\nExpected:", str(output), "\nRecieved:",
8989
str(tokens)])
90-
self.assertTrue(tokensMatch(tokens, output), errorMsg)
90+
self.assertEquals(tokensMatch(tokens, output), True, errorMsg)
9191

9292

9393
def test_tokenizer():

0 commit comments

Comments
 (0)