Commit 24156b0b authored by Olivier Crête's avatar Olivier Crête 👻

overrides: Remove IntRange And Int64Range on Python2

They use the range() built-in type which is a Python 3 change.

https://bugzilla.gnome.org/show_bug.cgi?id=782927
parent 2cfded48
......@@ -348,8 +348,9 @@ class IntRange(Gst.IntRange):
return '[%d,%d,%d]' % (self.range.start, self.range.stop,
self.range.step)
IntRange = override(IntRange)
__all__.append('IntRange')
if sys.version_info >= (3, 0):
IntRange = override(IntRange)
__all__.append('IntRange')
class Int64Range(Gst.Int64Range):
......@@ -380,8 +381,9 @@ class Int64Range(Gst.Int64Range):
self.range.step)
Int64Range = override(Int64Range)
__all__.append('Int64Range')
if sys.version_info >= (3, 0):
Int64Range = override(Int64Range)
__all__.append('Int64Range')
class DoubleRange(Gst.DoubleRange):
......
......@@ -23,6 +23,8 @@ overrides_hack
from common import TestCase
import unittest, sys
import gi
gi.require_version("Gst", "1.0")
from gi.repository import Gst
......@@ -31,6 +33,7 @@ Gst.init(None)
R = Gst.Int64Range
class TestInt64Range(TestCase):
@unittest.skipUnless(sys.version_info >= (3, 0), "requires Python 3")
def testConstructor(self):
Gst.init(None)
......@@ -42,11 +45,13 @@ class TestInt64Range(TestCase):
self.assertRaises(TypeError, R, 1)
self.assertRaises(TypeError, R)
@unittest.skipUnless(sys.version_info >= (3, 0), "requires Python 3")
def testRepr(self):
Gst.init(None)
self.assertEquals(repr(R(range(0, 10, 2))), '<Gst.Int64Range [0,10,2]>')
@unittest.skipUnless(sys.version_info >= (3, 0), "requires Python 3")
def testGetValue(self):
Gst.init(None)
......
......@@ -23,6 +23,8 @@ overrides_hack
from common import TestCase
import unittest, sys
import gi
gi.require_version("Gst", "1.0")
from gi.repository import Gst
......@@ -31,6 +33,7 @@ Gst.init(None)
R = Gst.IntRange
class TestIntRange(TestCase):
@unittest.skipUnless(sys.version_info >= (3, 0), "requires Python 3")
def testConstructor(self):
Gst.init(None)
......@@ -42,11 +45,13 @@ class TestIntRange(TestCase):
self.assertRaises(TypeError, R, 1)
self.assertRaises(TypeError, R)
@unittest.skipUnless(sys.version_info >= (3, 0), "requires Python 3")
def testRepr(self):
Gst.init(None)
self.assertEquals(repr(R(range(0, 10, 2))), '<Gst.IntRange [0,10,2]>')
@unittest.skipUnless(sys.version_info >= (3, 0), "requires Python 3")
def testGetValue(self):
Gst.init(None)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment