MCPcopy Index your code
hub / github.com/python/cpython / assert_equality_only

Method assert_equality_only

Lib/test/test_compare.py:224–249  ·  view source on GitHub ↗

Assert equality result and that ordering is not implemented. a, b: Instances to be tested (of same or different type). equal: Boolean indicating the expected equality comparison results.

(self, a, b, equal)

Source from the content-addressed store, hash-verified

222 return instances
223
224 def assert_equality_only(self, a, b, equal):
225 """Assert equality result and that ordering is not implemented.
226
227 a, b: Instances to be tested (of same or different type).
228 equal: Boolean indicating the expected equality comparison results.
229 """
230 self.assertEqual(a == b, equal)
231 self.assertEqual(b == a, equal)
232 self.assertEqual(a != b, not equal)
233 self.assertEqual(b != a, not equal)
234 with self.assertRaisesRegex(TypeError, "not supported"):
235 a < b
236 with self.assertRaisesRegex(TypeError, "not supported"):
237 a <= b
238 with self.assertRaisesRegex(TypeError, "not supported"):
239 a > b
240 with self.assertRaisesRegex(TypeError, "not supported"):
241 a >= b
242 with self.assertRaisesRegex(TypeError, "not supported"):
243 b < a
244 with self.assertRaisesRegex(TypeError, "not supported"):
245 b <= a
246 with self.assertRaisesRegex(TypeError, "not supported"):
247 b > a
248 with self.assertRaisesRegex(TypeError, "not supported"):
249 b >= a
250
251 def assert_total_order(self, a, b, comp, a_meth=None, b_meth=None):
252 """Test total ordering comparison of two instances.

Callers 4

test_objectsMethod · 0.95
test_numbersMethod · 0.95
test_sequencesMethod · 0.95
test_mappingsMethod · 0.95

Calls 2

assertRaisesRegexMethod · 0.80
assertEqualMethod · 0.45

Tested by

no test coverage detected