Exemplo n.º 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]])
Exemplo n.º 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]])
Exemplo n.º 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]])
Exemplo n.º 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]])
Exemplo n.º 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]])
Exemplo n.º 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]])
Exemplo n.º 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]])
Exemplo n.º 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]])