gst-python: Fix unit test for python >= 3.12

unittest.TestCase.assertEquals was marked deprecated since 3.0 and was finally
removed in 3.12

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5633>
This commit is contained in:
Edward Hervey 2024-02-02 11:24:31 +01:00 committed by Edward Hervey
parent 7c68ef354b
commit 900a9c47be

View file

@ -21,9 +21,9 @@ import sys
import overrides_hack import overrides_hack
overrides_hack overrides_hack
from common import TestCase, unittest from common import TestCase, unittest
from gi.repository import Gst from gi.repository import Gst
class TimeArgsTest(TestCase): class TimeArgsTest(TestCase):
def testNoneTime(self): def testNoneTime(self):
self.assertRaises(TypeError, Gst.TIME_ARGS, None) self.assertRaises(TypeError, Gst.TIME_ARGS, None)
@ -32,10 +32,11 @@ class TimeArgsTest(TestCase):
self.assertRaises(TypeError, Gst.TIME_ARGS, "String") self.assertRaises(TypeError, Gst.TIME_ARGS, "String")
def testClockTimeNone(self): def testClockTimeNone(self):
self.assertEquals(Gst.TIME_ARGS(Gst.CLOCK_TIME_NONE), 'CLOCK_TIME_NONE') self.assertEqual(Gst.TIME_ARGS(Gst.CLOCK_TIME_NONE), 'CLOCK_TIME_NONE')
def testOneSecond(self): def testOneSecond(self):
self.assertEquals(Gst.TIME_ARGS(Gst.SECOND), '0:00:01.000000000') self.assertEqual(Gst.TIME_ARGS(Gst.SECOND), '0:00:01.000000000')
class TestNotInitialized(TestCase): class TestNotInitialized(TestCase):
def testNotInitialized(self): def testNotInitialized(self):
@ -93,6 +94,7 @@ class TestBin(TestCase):
Gst.init(None) Gst.init(None)
self.assertEqual(Gst.ElementFactory.make("bin", None).sinkpads, []) self.assertEqual(Gst.ElementFactory.make("bin", None).sinkpads, [])
class TestBufferMap(TestCase): class TestBufferMap(TestCase):
def test_map_unmap_manual(self): def test_map_unmap_manual(self):
@ -112,5 +114,6 @@ class TestBufferMap(TestCase):
with self.assertRaises(ValueError): with self.assertRaises(ValueError):
info.data[0] info.data[0]
if __name__ == "__main__": if __name__ == "__main__":
unittest.main() unittest.main()