4
4
# Copyright Contributors to the OpenTimelineIO project
5
5
6
6
import opentimelineio as otio
7
- import opentimelineio ._otio
7
+ from opentimelineio ._otio import AnyDictionary , AnyVector
8
8
import opentimelineio .test_utils as otio_test_utils
9
- import opentimelineio .opentime
9
+ from opentimelineio .opentime import RationalTime , TimeRange , TimeTransform
10
10
11
11
import unittest
12
12
import json
@@ -39,11 +39,11 @@ def test_cons(self):
39
39
self .assertEqual (so .metadata ['foo' ], 'bar' )
40
40
41
41
def test_cons2 (self ):
42
- v = opentimelineio . _otio . AnyVector ()
42
+ v = AnyVector ()
43
43
v .append (1 )
44
44
v .append ('inside any vector' )
45
45
46
- d = opentimelineio . _otio . AnyDictionary ()
46
+ d = AnyDictionary ()
47
47
d ['key_1' ] = 1234
48
48
d ['key_2' ] = {'asdasdasd' : 5.6 }
49
49
so = otio .core .SerializableObjectWithMetadata (
@@ -54,13 +54,16 @@ def test_cons2(self):
54
54
'dict' : {'map1' : [345 ]},
55
55
'AnyVector' : v ,
56
56
'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
61
60
),
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 ),
64
67
scale = 999
65
68
)
66
69
}
@@ -69,22 +72,34 @@ def test_cons2(self):
69
72
self .assertEqual (so .metadata ['foo' ], 'bar' )
70
73
self .assertEqual (so .metadata ['string' ], 'myvalue' )
71
74
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 )
85
100
))
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 ),
88
103
scale = 999
89
104
))
90
105
0 commit comments