Back to index

python3.2  3.2.2
Public Member Functions
test.test_builtin.TestSorted Class Reference

List of all members.

Public Member Functions

def test_basic
def test_inputtypes
def test_baddecorator

Detailed Description

Definition at line 1330 of file test_builtin.py.


Member Function Documentation

Definition at line 1358 of file test_builtin.py.

01358 
01359     def test_baddecorator(self):
01360         data = 'The quick Brown fox Jumped over The lazy Dog'.split()
01361         self.assertRaises(TypeError, sorted, data, None, lambda x,y: 0)

Here is the call graph for this function:

Definition at line 1332 of file test_builtin.py.

01332 
01333     def test_basic(self):
01334         data = list(range(100))
01335         copy = data[:]
01336         random.shuffle(copy)
01337         self.assertEqual(data, sorted(copy))
01338         self.assertNotEqual(data, copy)
01339 
01340         data.reverse()
01341         random.shuffle(copy)
01342         self.assertEqual(data, sorted(copy, key=lambda x: -x))
01343         self.assertNotEqual(data, copy)
01344         random.shuffle(copy)
01345         self.assertEqual(data, sorted(copy, reverse=1))
01346         self.assertNotEqual(data, copy)

Here is the call graph for this function:

Definition at line 1347 of file test_builtin.py.

01347 
01348     def test_inputtypes(self):
01349         s = 'abracadabra'
01350         types = [list, tuple, str]
01351         for T in types:
01352             self.assertEqual(sorted(s), sorted(T(s)))
01353 
01354         s = ''.join(set(s))  # unique letters only
01355         types = [str, set, frozenset, list, tuple, dict.fromkeys]
01356         for T in types:
01357             self.assertEqual(sorted(s), sorted(T(s)))

Here is the call graph for this function:


The documentation for this class was generated from the following file: