| 1 | class AppTestMin: |
| 2 | |
| 3 | def test_min_notseq(self): |
| 4 | raises(TypeError, min, 1) |
| 5 | |
| 6 | def test_min_usual(self): |
| 7 | assert min(1, 2, 3) == 1 |
| 8 | |
| 9 | def test_min_floats(self): |
| 10 | assert min(0.1, 2.7, 14.7) == 0.1 |
| 11 | |
| 12 | def test_min_chars(self): |
| 13 | assert min('a', 'b', 'c') == 'a' |
| 14 | |
| 15 | def test_min_strings(self): |
| 16 | assert min('aaa', 'bbb', 'c') == 'aaa' |
| 17 | |
| 18 | def test_min_noargs(self): |
| 19 | raises(TypeError, min) |
| 20 | |
| 21 | def test_min_empty(self): |
| 22 | raises(ValueError, min, []) |
| 23 | |
| 24 | def test_min_default(self): |
| 25 | assert min([], default=-1) == -1 |
| 26 | assert min([], default=None) is None |
| 27 | |
| 28 | class AppTestMax: |
| 29 | |
| 30 | def test_max_notseq(self): |
| 31 | raises(TypeError, max, 1) |
| 32 | |
| 33 | def test_max_usual(self): |
| 34 | assert max(1, 2, 3) == 3 |
| 35 | |
| 36 | def test_max_floats(self): |
| 37 | assert max(0.1, 2.7, 14.7) == 14.7 |
| 38 | |
| 39 | def test_max_chars(self): |
| 40 | assert max('a', 'b', 'c') == 'c' |
| 41 | |
| 42 | def test_max_strings(self): |
| 43 | assert max('aaa', 'bbb', 'c') == 'c' |
| 44 | |
| 45 | def test_max_noargs(self): |
| 46 | raises(TypeError, max) |
| 47 | |
| 48 | def test_max_empty(self): |
| 49 | raises(ValueError, max, []) |
| 50 | |
| 51 | class AppTestMaxTuple: |
| 52 | |
| 53 | def test_max_usual(self): |
| 54 | assert max((1, 2, 3)) == 3 |
| 55 | |
| 56 | def test_max_floats(self): |
| 57 | assert max((0.1, 2.7, 14.7)) == 14.7 |
| 58 | |
| 59 | def test_max_chars(self): |
| 60 | assert max(('a', 'b', 'c')) == 'c' |
| 61 | |
| 62 | def test_max_strings(self): |
| 63 | assert max(('aaa', 'bbb', 'c')) == 'c' |
| 64 | |
| 65 | class AppTestMinList: |
| 66 | |
| 67 | def test_min_usual(self): |
| 68 | assert min([1, 2, 3]) == 1 |
| 69 | |
| 70 | def test_min_floats(self): |
| 71 | assert min([0.1, 2.7, 14.7]) == 0.1 |
| 72 | |
| 73 | def test_min_chars(self): |
| 74 | assert min(['a', 'b', 'c']) == 'a' |
| 75 | |
| 76 | def test_min_strings(self): |
| 77 | assert min(['aaa', 'bbb', 'c']) == 'aaa' |