| @@ 139-157 (lines=19) @@ | ||
| 136 | with self.assertRaises(TypeError): |
|
| 137 | _ = color1 == 'dummy' |
|
| 138 | ||
| 139 | def test___gt__(self): |
|
| 140 | Color = imprecise_category('Color', ['R', 'G', 'B']) |
|
| 141 | color1 = Color(['R']) |
|
| 142 | color2 = Color(['R', 'G']) |
|
| 143 | color3 = Color(['R', 'B']) |
|
| 144 | self.assertTrue( |
|
| 145 | color2 > color1, |
|
| 146 | "['R', 'G'] is a strict superset of ['R']" |
|
| 147 | ) |
|
| 148 | self.assertFalse( |
|
| 149 | color1 > color1, |
|
| 150 | "['R'] is not a strict superset of ['R']" |
|
| 151 | ) |
|
| 152 | self.assertFalse( |
|
| 153 | color2 > color3, |
|
| 154 | "['R', 'G'] is not a strict superset of ['R', 'B']" |
|
| 155 | ) |
|
| 156 | with self.assertRaises(TypeError): |
|
| 157 | _ = color1 > 'dummy' |
|
| 158 | ||
| 159 | def test___and__(self): |
|
| 160 | Color = imprecise_category('Color', ['R', 'G', 'B']) |
|
| @@ 103-121 (lines=19) @@ | ||
| 100 | with self.assertRaises(TypeError): |
|
| 101 | _ = color1 <= 'dummy' |
|
| 102 | ||
| 103 | def test___lt__(self): |
|
| 104 | Color = imprecise_category('Color', ['R', 'G', 'B']) |
|
| 105 | color1 = Color(['R']) |
|
| 106 | color2 = Color(['R', 'G']) |
|
| 107 | color3 = Color(['R', 'B']) |
|
| 108 | self.assertTrue( |
|
| 109 | color1 < color2, |
|
| 110 | "['R'] is a strict subset of ['R', 'G']" |
|
| 111 | ) |
|
| 112 | self.assertFalse( |
|
| 113 | color1 < color1, |
|
| 114 | "['R'] is not a strict subset of ['R']" |
|
| 115 | ) |
|
| 116 | self.assertFalse( |
|
| 117 | color2 < color3, |
|
| 118 | "['R', 'G'] is not a strict subset of ['R', 'B']" |
|
| 119 | ) |
|
| 120 | with self.assertRaises(TypeError): |
|
| 121 | _ = color1 < 'dummy' |
|
| 122 | ||
| 123 | def test___eq__(self): |
|
| 124 | Color = imprecise_category('Color', ['R', 'G', 'B']) |
|
| @@ 83-101 (lines=19) @@ | ||
| 80 | "The iteration over the color must be ['R', 'G']" |
|
| 81 | ) |
|
| 82 | ||
| 83 | def test___le__(self): |
|
| 84 | Color = imprecise_category('Color', ['R', 'G', 'B']) |
|
| 85 | color1 = Color(['R']) |
|
| 86 | color2 = Color(['R', 'G']) |
|
| 87 | color3 = Color(['R', 'B']) |
|
| 88 | self.assertTrue( |
|
| 89 | color1 <= color2, |
|
| 90 | "['R'] is a subset of ['R', 'G']" |
|
| 91 | ) |
|
| 92 | self.assertTrue( |
|
| 93 | color1 <= color1, |
|
| 94 | "['R'] is a subset of ['R']" |
|
| 95 | ) |
|
| 96 | self.assertFalse( |
|
| 97 | color2 <= color3, |
|
| 98 | "['R', 'G'] is not a subset of ['R', 'B']" |
|
| 99 | ) |
|
| 100 | with self.assertRaises(TypeError): |
|
| 101 | _ = color1 <= 'dummy' |
|
| 102 | ||
| 103 | def test___lt__(self): |
|
| 104 | Color = imprecise_category('Color', ['R', 'G', 'B']) |
|