def test06(self): scores = hw2.scoreList(['a', 's', 'm', 'o', 'f', 'o']) # Sort by scores scores.sort(key=operator.itemgetter(1)) self.assertEqual(scores, [['a', 1], ['am', 4], ['foo', 6]])
def test04(self): scores = hw2.scoreList(['r', 's', 't', 'n', 'l', 'e', 'a']) # Sort by scores scores.sort(key=operator.itemgetter(1)) self.assertEqual(scores, [['a', 1], ['at', 2]])
def test05(self): scores = hw2.scoreList(['b', 't', 'f', 'c', 'a', 'o']) # Sort by scores scores.sort(key=operator.itemgetter(1)) self.assertEqual(scores, [['a', 1], ['at', 2], ['bat', 5]])
def test03(self): scores = hw2.scoreList(['a', 's', 'm', 't', 'p']) # Sort by scores scores.sort(key=operator.itemgetter(1)) self.assertEqual(scores, [['a', 1], ['at', 2], ['am', 4], ['spam', 8]])