From 2a0cb22b55916b60223cae9e4a26cea8f7b27a31 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jeremy=20Lain=C3=A9?= Date: Mon, 30 Oct 2023 17:28:13 +0100 Subject: [PATCH] Remove backports of `unittest` matchers This is unnecessary since we only support Python 3. --- tests/common.py | 40 ---------------------------------------- 1 file changed, 40 deletions(-) diff --git a/tests/common.py b/tests/common.py index 8431ba911..5b12ca0d9 100644 --- a/tests/common.py +++ b/tests/common.py @@ -3,7 +3,6 @@ import errno import functools import os -import sys import types from av.datasets import fate as fate_suite @@ -159,42 +158,3 @@ def assertImagesAlmostEqual(self, a, b, epsilon=0.1, *args): self.fail( "images differed by %s at index %d; %s %s" % (diff, i, ax, bx) ) - - # Add some of the unittest methods that we love from 2.7. - if sys.version_info < (2, 7): - - def assertIs(self, a, b, msg=None): - if a is not b: - self.fail( - msg - or "%r at 0x%x is not %r at 0x%x; %r is not %r" - % (type(a), id(a), type(b), id(b), a, b) - ) - - def assertIsNot(self, a, b, msg=None): - if a is b: - self.fail(msg or "both are %r at 0x%x; %r" % (type(a), id(a), a)) - - def assertIsNone(self, x, msg=None): - if x is not None: - self.fail(msg or "is not None; %r" % x) - - def assertIsNotNone(self, x, msg=None): - if x is None: - self.fail(msg or "is None; %r" % x) - - def assertIn(self, a, b, msg=None): - if a not in b: - self.fail(msg or "%r not in %r" % (a, b)) - - def assertNotIn(self, a, b, msg=None): - if a in b: - self.fail(msg or "%r in %r" % (a, b)) - - def assertIsInstance(self, instance, types, msg=None): - if not isinstance(instance, types): - self.fail(msg or "not an instance of %r; %r" % (types, instance)) - - def assertNotIsInstance(self, instance, types, msg=None): - if isinstance(instance, types): - self.fail(msg or "is an instance of %r; %r" % (types, instance))