Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def test_delete_parent_container(self):
# deleting the parent container should null out the parent pointer
it = otio.core.Item()
sq = otio.schema.Track(children=[it])
del sq
self.assertIsNone(it.parent())
def test_equality(self):
m = otio.schema.Marker()
bo = otio.core.Item()
self.assertNotEqual(m, bo)
self.assertNotEqual(bo, m)
def test_copy_arguments(self):
# make sure all the arguments are copied and not referenced
tr = otio.opentime.TimeRange(
otio.opentime.RationalTime(0, 24),
otio.opentime.RationalTime(10, 24),
)
name = "foobar"
effects = []
markers = []
metadata = {}
it = otio.core.Item(
name=name,
source_range=tr,
effects=effects,
markers=markers,
metadata=metadata,
)
name = 'foobaz'
self.assertNotEqual(it.name, name)
tr = otio.opentime.TimeRange(
otio.opentime.RationalTime(1, tr.start_time.rate),
duration=tr.duration
)
self.assertNotEqual(it.source_range.start_time, tr.start_time)
markers.append(otio.schema.Marker())
self.assertNotEqual(it.markers, markers)
def test_equality(self):
co0 = otio.core.Composition()
co00 = otio.core.Composition()
self.assertIsOTIOEquivalentTo(co0, co00)
a = otio.core.Item(name="A")
b = otio.core.Item(name="B")
c = otio.core.Item(name="C")
co1 = otio.core.Composition(children=[a, b, c])
x = otio.core.Item(name="X")
y = otio.core.Item(name="Y")
z = otio.core.Item(name="Z")
co2 = otio.core.Composition(children=[x, y, z])
a2 = otio.core.Item(name="A")
b2 = otio.core.Item(name="B")
c2 = otio.core.Item(name="C")
co3 = otio.core.Composition(children=[a2, b2, c2])
self.assertTrue(co1 is not co2)
self.assertNotEqual(co1, co2)
self.assertTrue(co1 is not co3)
self.assertIsOTIOEquivalentTo(co1, co3)
def test_available_range(self):
it = otio.core.Item()
with self.assertRaises(NotImplementedError):
it.available_range()
def test_duration(self):
it = otio.core.Item()
tr = otio.opentime.TimeRange(
otio.opentime.RationalTime(0, 1),
otio.opentime.RationalTime(10, 1)
)
it = otio.core.Item(source_range=tr)
self.assertEqual(it.duration(), tr.duration)
def test_equality(self):
co0 = otio.core.Composition()
co00 = otio.core.Composition()
self.assertIsOTIOEquivalentTo(co0, co00)
a = otio.core.Item(name="A")
b = otio.core.Item(name="B")
c = otio.core.Item(name="C")
co1 = otio.core.Composition(children=[a, b, c])
x = otio.core.Item(name="X")
y = otio.core.Item(name="Y")
z = otio.core.Item(name="Z")
co2 = otio.core.Composition(children=[x, y, z])
a2 = otio.core.Item(name="A")
b2 = otio.core.Item(name="B")
c2 = otio.core.Item(name="C")
co3 = otio.core.Composition(children=[a2, b2, c2])
self.assertTrue(co1 is not co2)
self.assertNotEqual(co1, co2)
self.assertTrue(co1 is not co3)
self.assertIsOTIOEquivalentTo(co1, co3)
"""Implementation of the Clip class, for pointing at media."""
import copy
from .. import (
core,
exceptions,
)
from . import (
missing_reference
)
@core.register_type
class Clip(core.Item):
"""The base editable object in OTIO.
Contains a media reference and a trim on that media reference.
"""
_serializable_label = "Clip.1"
def __init__(
self,
name=None,
media_reference=None,
source_range=None,
markers=[],
effects=[],
metadata=None,
):
def __init__(
self,
name=None,
media_reference=None,
source_range=None,
markers=[],
effects=[],
metadata=None,
):
core.Item.__init__(
self,
name=name,
source_range=source_range,
markers=markers,
effects=effects,
metadata=metadata
)
if not media_reference:
media_reference = missing_reference.MissingReference()
self._media_reference = copy.deepcopy(media_reference)