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): ...@@ -348,8 +348,9 @@ class IntRange(Gst.IntRange):
return '[%d,%d,%d]' % (self.range.start, self.range.stop, return '[%d,%d,%d]' % (self.range.start, self.range.stop,
self.range.step) self.range.step)
IntRange = override(IntRange) if sys.version_info >= (3, 0):
__all__.append('IntRange') IntRange = override(IntRange)
__all__.append('IntRange')
class Int64Range(Gst.Int64Range): class Int64Range(Gst.Int64Range):
...@@ -380,8 +381,9 @@ class Int64Range(Gst.Int64Range): ...@@ -380,8 +381,9 @@ class Int64Range(Gst.Int64Range):
self.range.step) self.range.step)
Int64Range = override(Int64Range) if sys.version_info >= (3, 0):
__all__.append('Int64Range') Int64Range = override(Int64Range)
__all__.append('Int64Range')
class DoubleRange(Gst.DoubleRange): class DoubleRange(Gst.DoubleRange):
......
...@@ -23,6 +23,8 @@ overrides_hack ...@@ -23,6 +23,8 @@ overrides_hack
from common import TestCase from common import TestCase
import unittest, sys
import gi import gi
gi.require_version("Gst", "1.0") gi.require_version("Gst", "1.0")
from gi.repository import Gst from gi.repository import Gst
...@@ -31,6 +33,7 @@ Gst.init(None) ...@@ -31,6 +33,7 @@ Gst.init(None)
R = Gst.Int64Range R = Gst.Int64Range
class TestInt64Range(TestCase): class TestInt64Range(TestCase):
@unittest.skipUnless(sys.version_info >= (3, 0), "requires Python 3")
def testConstructor(self): def testConstructor(self):
Gst.init(None) Gst.init(None)
...@@ -42,11 +45,13 @@ class TestInt64Range(TestCase): ...@@ -42,11 +45,13 @@ class TestInt64Range(TestCase):
self.assertRaises(TypeError, R, 1) self.assertRaises(TypeError, R, 1)
self.assertRaises(TypeError, R) self.assertRaises(TypeError, R)
@unittest.skipUnless(sys.version_info >= (3, 0), "requires Python 3")
def testRepr(self): def testRepr(self):
Gst.init(None) Gst.init(None)
self.assertEquals(repr(R(range(0, 10, 2))), '<Gst.Int64Range [0,10,2]>') 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): def testGetValue(self):
Gst.init(None) Gst.init(None)
......
...@@ -23,6 +23,8 @@ overrides_hack ...@@ -23,6 +23,8 @@ overrides_hack
from common import TestCase from common import TestCase
import unittest, sys
import gi import gi
gi.require_version("Gst", "1.0") gi.require_version("Gst", "1.0")
from gi.repository import Gst from gi.repository import Gst
...@@ -31,6 +33,7 @@ Gst.init(None) ...@@ -31,6 +33,7 @@ Gst.init(None)
R = Gst.IntRange R = Gst.IntRange
class TestIntRange(TestCase): class TestIntRange(TestCase):
@unittest.skipUnless(sys.version_info >= (3, 0), "requires Python 3")
def testConstructor(self): def testConstructor(self):
Gst.init(None) Gst.init(None)
...@@ -42,11 +45,13 @@ class TestIntRange(TestCase): ...@@ -42,11 +45,13 @@ class TestIntRange(TestCase):
self.assertRaises(TypeError, R, 1) self.assertRaises(TypeError, R, 1)
self.assertRaises(TypeError, R) self.assertRaises(TypeError, R)
@unittest.skipUnless(sys.version_info >= (3, 0), "requires Python 3")
def testRepr(self): def testRepr(self):
Gst.init(None) Gst.init(None)
self.assertEquals(repr(R(range(0, 10, 2))), '<Gst.IntRange [0,10,2]>') 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): def testGetValue(self):
Gst.init(None) 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