@@ 251-269 (lines=19) @@ | ||
248 | _ = color1.issubset(125) |
|
249 | ||
250 | def test_issuperset(self): |
|
251 | Color = imprecise_category('Color', ['R', 'G', 'B']) |
|
252 | color1 = Color(['B']) |
|
253 | color2 = Color(['R', 'G']) |
|
254 | color3 = Color(['R', 'B']) |
|
255 | self.assertFalse( |
|
256 | color1.issuperset(color2), |
|
257 | "['B'] is not a superset of ['R', 'G']" |
|
258 | ) |
|
259 | self.assertTrue( |
|
260 | color3.issuperset(color1), |
|
261 | "['R', 'B'] is a superset of ['B']" |
|
262 | ) |
|
263 | self.assertTrue( |
|
264 | color3.issuperset(['R']), |
|
265 | "['R', 'B'] is a superset of ['R']" |
|
266 | ) |
|
267 | with self.assertRaises(TypeError): |
|
268 | _ = color1.issuperset(125) |
|
269 | ||
270 | def test_union(self): |
|
271 | Color = imprecise_category('Color', ['R', 'G', 'B']) |
|
272 | color1 = Color(['B', 'R']) |
|
@@ 231-249 (lines=19) @@ | ||
228 | _ = color1.isdisjoint(125) |
|
229 | ||
230 | def test_issubset(self): |
|
231 | Color = imprecise_category('Color', ['R', 'G', 'B']) |
|
232 | color1 = Color(['B']) |
|
233 | color2 = Color(['R', 'G']) |
|
234 | color3 = Color(['R', 'B']) |
|
235 | self.assertFalse( |
|
236 | color1.issubset(color2), |
|
237 | "['B'] is not a subset of ['R', 'G']" |
|
238 | ) |
|
239 | self.assertTrue( |
|
240 | color1.issubset(color3), |
|
241 | "['B'] is a subset of ['R', 'B']" |
|
242 | ) |
|
243 | self.assertTrue( |
|
244 | color1.issubset(['B', 'G']), |
|
245 | "['B'] is a subset of ['B', 'G']" |
|
246 | ) |
|
247 | with self.assertRaises(TypeError): |
|
248 | _ = color1.issubset(125) |
|
249 | ||
250 | def test_issuperset(self): |
|
251 | Color = imprecise_category('Color', ['R', 'G', 'B']) |
|
252 | color1 = Color(['B']) |
|
@@ 211-229 (lines=19) @@ | ||
208 | _ = color1 ^ 'dummy' |
|
209 | ||
210 | def test_isdisjoint(self): |
|
211 | Color = imprecise_category('Color', ['R', 'G', 'B']) |
|
212 | color1 = Color(['B']) |
|
213 | color2 = Color(['R', 'G']) |
|
214 | color3 = Color(['R', 'B']) |
|
215 | self.assertTrue( |
|
216 | color1.isdisjoint(color2), |
|
217 | "bool(['B'] & ['R', 'G']) = True" |
|
218 | ) |
|
219 | self.assertFalse( |
|
220 | color1.isdisjoint(color3), |
|
221 | "bool(['B'] & ['R', 'B']) = False" |
|
222 | ) |
|
223 | self.assertTrue( |
|
224 | color1.isdisjoint(['R', 'G']), |
|
225 | "bool(['B'] & ['R', 'G']) = True" |
|
226 | ) |
|
227 | with self.assertRaises(TypeError): |
|
228 | _ = color1.isdisjoint(125) |
|
229 | ||
230 | def test_issubset(self): |
|
231 | Color = imprecise_category('Color', ['R', 'G', 'B']) |
|
232 | color1 = Color(['B']) |