Skip to content

Commit

Permalink
Remove backports of unittest matchers
Browse files Browse the repository at this point in the history
This is unnecessary since we only support Python 3.
  • Loading branch information
jlaine committed Oct 30, 2023
1 parent 1a8b2a8 commit 24bcd1f
Showing 1 changed file with 0 additions and 40 deletions.
40 changes: 0 additions & 40 deletions tests/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import errno
import functools
import os
import sys
import types

from av.datasets import fate as fate_suite
Expand Down Expand Up @@ -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))

0 comments on commit 24bcd1f

Please sign in to comment.