Пример #1
0
 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]])
Пример #2
0
 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]])
Пример #3
0
 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]])
Пример #4
0
 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]])
Пример #5
0
 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]])
Пример #6
0
 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]])
Пример #7
0
 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]])
Пример #8
0
 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]])