@@ -71,22 +71,22 @@ class HClusterIntegerTestCase(unittest.TestCase):
7171
7272 def setUp (self ):
7373 self .__data = [791 , 956 , 676 , 124 , 564 , 84 , 24 , 365 , 594 , 940 , 398 ,
74- 971 , 131 , 365 , 542 , 336 , 518 , 835 , 134 , 391 ]
74+ 971 , 131 , 365 , 542 , 336 , 518 , 835 , 134 , 391 ]
7575
7676 def testCluster (self ):
7777 "Basic Hierarchical Clustering test with integers"
7878 cl = HierarchicalClustering (self .__data , lambda x , y : abs (x - y ))
7979 cl .cluster ()
8080 self .assertEqual ([
81- [24 ],
82- [84 , 124 , 131 , 134 ],
83- [336 , 365 , 365 , 365 , 398 , 391 ],
84- [ 940 , 956 , 971 ],
85- [ 791 ],
86- [ 835 ],
87- [ 676 ],
88- [ 518 , 564 , 542 ] ],
89- cl .getlevel (40 ))
81+ [24 ],
82+ [84 , 124 , 131 , 134 ],
83+ [336 , 365 , 365 , 391 , 398 ],
84+ [ 676 ],
85+ [ 594 , 518 , 542 , 564 ],
86+ [ 940 , 956 , 971 ],
87+ [ 791 ],
88+ [ 835 ],
89+ ], cl .getlevel (40 ))
9090
9191 def testUnmodifiedData (self ):
9292 cl = HierarchicalClustering (self .__data , lambda x , y : abs (x - y ))
@@ -102,9 +102,9 @@ def sim(self, x, y):
102102 return 1 - sm .ratio ()
103103
104104 def setUp (self ):
105- self .__data = ("Lorem ipsum dolor sit amet, consectetuer adipiscing "
106- "elit. Ut elit. Phasellus consequat ultricies mi. Sed congue "
107- " leo at neque. Nullam. " ). split ()
105+ self .__data = ("Lorem ipsum dolor sit amet consectetuer adipiscing "
106+ "elit Ut elit Phasellus consequat ultricies mi Sed "
107+ "congue leo at neque Nullam" ).split ()
108108
109109 def testDataTypes (self ):
110110 "Test for bug #?"
@@ -118,19 +118,17 @@ def testCluster(self):
118118 "Basic Hierachical clustering test with strings"
119119 cl = HierarchicalClustering (self .__data , self .sim )
120120 self .assertEqual ([
121- ['Nullam.' ],
122- ['Sed' ],
123- ['mi.' ],
124- ['ultricies' ],
125- ['Phasellus' ],
126- ['amet,' , 'at' ],
127- ['sit' , 'elit.' , 'elit.' , 'elit.' ],
128- ['leo' , 'Lorem' , 'dolor' ],
129- ['neque.' , 'congue' , 'consectetuer' , 'consequat' ],
130- ['ipsum' ],
131- ['adipiscing' ]
132- ],
133- cl .getlevel (0.5 ))
121+ ['ultricies' ],
122+ ['Sed' ],
123+ ['Phasellus' ],
124+ ['mi' ],
125+ ['Nullam' ],
126+ ['sit' , 'elit' , 'elit' , 'Ut' , 'amet' , 'at' ],
127+ ['leo' , 'Lorem' , 'dolor' ],
128+ ['congue' , 'neque' , 'consectetuer' , 'consequat' ],
129+ ['adipiscing' ],
130+ ['ipsum' ],
131+ ], cl .getlevel (0.5 ))
134132
135133 def testUnmodifiedData (self ):
136134 cl = HierarchicalClustering (self .__data , self .sim )
0 commit comments