44# Copyright Contributors to the OpenTimelineIO project
55
66import opentimelineio as otio
7- import opentimelineio ._otio
7+ from opentimelineio ._otio import AnyDictionary , AnyVector
88import opentimelineio .test_utils as otio_test_utils
9- import opentimelineio .opentime
9+ from opentimelineio .opentime import RationalTime , TimeRange , TimeTransform
1010
1111import unittest
1212import json
@@ -39,11 +39,11 @@ def test_cons(self):
3939 self .assertEqual (so .metadata ['foo' ], 'bar' )
4040
4141 def test_cons2 (self ):
42- v = opentimelineio . _otio . AnyVector ()
42+ v = AnyVector ()
4343 v .append (1 )
4444 v .append ('inside any vector' )
4545
46- d = opentimelineio . _otio . AnyDictionary ()
46+ d = AnyDictionary ()
4747 d ['key_1' ] = 1234
4848 d ['key_2' ] = {'asdasdasd' : 5.6 }
4949 so = otio .core .SerializableObjectWithMetadata (
@@ -54,13 +54,16 @@ def test_cons2(self):
5454 'dict' : {'map1' : [345 ]},
5555 'AnyVector' : v ,
5656 'AnyDictionary' : d ,
57- 'RationalTime' : opentimelineio .opentime .RationalTime (value = 10.0 , rate = 5.0 ),
58- 'TimeRange' : opentimelineio .opentime .TimeRange (
59- opentimelineio .opentime .RationalTime (value = 1.0 ),
60- opentimelineio .opentime .RationalTime (value = 100.0 )
57+ 'RationalTime' : RationalTime (
58+ value = 10.0 ,
59+ rate = 5.0
6160 ),
62- 'TimeTransform' : opentimelineio .opentime .TimeTransform (
63- offset = opentimelineio .opentime .RationalTime (value = 55.0 ),
61+ 'TimeRange' : TimeRange (
62+ RationalTime (value = 1.0 ),
63+ RationalTime (value = 100.0 )
64+ ),
65+ 'TimeTransform' : TimeTransform (
66+ offset = RationalTime (value = 55.0 ),
6467 scale = 999
6568 )
6669 }
@@ -69,22 +72,34 @@ def test_cons2(self):
6972 self .assertEqual (so .metadata ['foo' ], 'bar' )
7073 self .assertEqual (so .metadata ['string' ], 'myvalue' )
7174 self .assertEqual (so .metadata ['int' ], - 999999999999 )
72- self .assertIsInstance (so .metadata ['list' ], opentimelineio ._otio .AnyVector )
73- self .assertEqual (so .metadata ['list' ], opentimelineio ._otio .AnyVector ([1 , 2.5 , 'asd' ]))
74- self .assertIsInstance (so .metadata ['dict' ], opentimelineio ._otio .AnyDictionary )
75- self .assertIsInstance (so .metadata ['dict' ]['map1' ], opentimelineio ._otio .AnyVector )
76- self .assertEqual (so .metadata ['dict' ], opentimelineio ._otio .AnyDictionary ({'map1' : [345 ]}))
77- self .assertIsInstance (so .metadata ['AnyVector' ], opentimelineio ._otio .AnyVector )
78- self .assertEqual (list (so .metadata ['AnyVector' ]), opentimelineio ._otio .AnyVector ([1 , 'inside any vector' ]))
79- self .assertIsInstance (so .metadata ['AnyDictionary' ], opentimelineio ._otio .AnyDictionary )
80- self .assertEqual (so .metadata ['AnyDictionary' ], opentimelineio ._otio .AnyDictionary ({'key_1' : 1234 , 'key_2' : {'asdasdasd' : 5.6 }}))
81- self .assertEqual (so .metadata ['RationalTime' ], opentimelineio .opentime .RationalTime (value = 10.0 , rate = 5.0 ))
82- self .assertEqual (so .metadata ['TimeRange' ], opentimelineio .opentime .TimeRange (
83- opentimelineio .opentime .RationalTime (value = 1.0 ),
84- opentimelineio .opentime .RationalTime (value = 100.0 )
75+ self .assertIsInstance (so .metadata ['list' ], AnyVector )
76+ self .assertEqual (
77+ so .metadata ['list' ],
78+ AnyVector ([1 , 2.5 , 'asd' ])
79+ )
80+ self .assertIsInstance (so .metadata ['dict' ], AnyDictionary )
81+ self .assertIsInstance (so .metadata ['dict' ]['map1' ], AnyVector )
82+ self .assertEqual (so .metadata ['dict' ], AnyDictionary ({'map1' : [345 ]}))
83+ self .assertIsInstance (so .metadata ['AnyVector' ], AnyVector )
84+ self .assertEqual (
85+ so .metadata ['AnyVector' ],
86+ AnyVector ([1 , 'inside any vector' ])
87+ )
88+ self .assertIsInstance (so .metadata ['AnyDictionary' ], AnyDictionary )
89+ self .assertEqual (
90+ so .metadata ['AnyDictionary' ],
91+ AnyDictionary ({'key_1' : 1234 , 'key_2' : {'asdasdasd' : 5.6 }})
92+ )
93+ self .assertEqual (
94+ so .metadata ['RationalTime' ],
95+ RationalTime (value = 10.0 , rate = 5.0 )
96+ )
97+ self .assertEqual (so .metadata ['TimeRange' ], TimeRange (
98+ RationalTime (value = 1.0 ),
99+ RationalTime (value = 100.0 )
85100 ))
86- self .assertEqual (so .metadata ['TimeTransform' ], opentimelineio . opentime . TimeTransform (
87- offset = opentimelineio . opentime . RationalTime (value = 55.0 ),
101+ self .assertEqual (so .metadata ['TimeTransform' ], TimeTransform (
102+ offset = RationalTime (value = 55.0 ),
88103 scale = 999
89104 ))
90105
0 commit comments