2 # Copyright (C) 2019 EfficiOS Inc.
4 # This program is free software; you can redistribute it and/or
5 # modify it under the terms of the GNU General Public License
6 # as published by the Free Software Foundation; only version 2
9 # This program is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 # GNU General Public License for more details.
14 # You should have received a copy of the GNU General Public License
15 # along with this program; if not, write to the Free Software
16 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
25 @unittest.skip("this is broken")
26 class CtfWriterClockTestCase(unittest
.TestCase
):
28 self
._clock
= bt2
.CtfWriterClock('salut')
33 def test_create_default(self
):
34 self
.assertEqual(self
._clock
.name
, 'salut')
36 def test_create_invalid_no_name(self
):
37 with self
.assertRaises(TypeError):
40 def test_create_full(self
):
41 my_uuid
= uuid
.uuid1()
42 cc
= bt2
.CtfWriterClock(
44 description
='some description',
47 offset
=bt2
.ClockClassOffset(45, 3003),
51 self
.assertEqual(cc
.name
, 'name')
52 self
.assertEqual(cc
.description
, 'some description')
53 self
.assertEqual(cc
.frequency
, 1001)
54 self
.assertEqual(cc
.precision
, 176)
55 self
.assertEqual(cc
.offset
, bt2
.ClockClassOffset(45, 3003))
56 self
.assertEqual(cc
.is_absolute
, True)
57 self
.assertEqual(cc
.uuid
, copy
.deepcopy(my_uuid
))
59 def test_assign_description(self
):
60 self
._clock
.description
= 'hi people'
61 self
.assertEqual(self
._clock
.description
, 'hi people')
63 def test_assign_invalid_description(self
):
64 with self
.assertRaises(TypeError):
65 self
._clock
.description
= 23
67 def test_assign_frequency(self
):
68 self
._clock
.frequency
= 987654321
69 self
.assertEqual(self
._clock
.frequency
, 987654321)
71 def test_assign_invalid_frequency(self
):
72 with self
.assertRaises(TypeError):
73 self
._clock
.frequency
= 'lel'
75 def test_assign_precision(self
):
76 self
._clock
.precision
= 12
77 self
.assertEqual(self
._clock
.precision
, 12)
79 def test_assign_invalid_precision(self
):
80 with self
.assertRaises(TypeError):
81 self
._clock
.precision
= 'lel'
83 def test_assign_offset(self
):
84 self
._clock
.offset
= bt2
.ClockClassOffset(12, 56)
85 self
.assertEqual(self
._clock
.offset
, bt2
.ClockClassOffset(12, 56))
87 def test_assign_invalid_offset(self
):
88 with self
.assertRaises(TypeError):
89 self
._clock
.offset
= object()
91 def test_assign_absolute(self
):
92 self
._clock
.is_absolute
= True
93 self
.assertTrue(self
._clock
.is_absolute
)
95 def test_assign_invalid_absolute(self
):
96 with self
.assertRaises(TypeError):
97 self
._clock
.is_absolute
= 23
99 def test_assign_uuid(self
):
100 the_uuid
= uuid
.uuid1()
101 self
._clock
.uuid
= the_uuid
102 self
.assertEqual(self
._clock
.uuid
, the_uuid
)
104 def test_assign_invalid_uuid(self
):
105 with self
.assertRaises(TypeError):
106 self
._clock
.uuid
= object()
108 def test_assign_time(self
):
109 self
._clock
.time
= 41232
111 def test_assign_invalid_time(self
):
112 with self
.assertRaises(TypeError):
113 self
._clock
.time
= object()
115 def _test_copy(self
, cpy
):
116 self
.assertIsNot(cpy
, self
._clock
)
117 self
.assertNotEqual(cpy
.addr
, self
._clock
.addr
)
118 self
.assertEqual(cpy
, self
._clock
)
121 cpy
= copy
.copy(self
._clock
)
124 def test_deepcopy(self
):
125 cpy
= copy
.deepcopy(self
._clock
)
129 my_uuid
= uuid
.uuid1()
130 cc1
= bt2
.CtfWriterClock(
132 description
='some description',
135 offset
=bt2
.ClockClassOffset(45, 3003),
139 cc2
= bt2
.CtfWriterClock(
141 description
='some description',
144 offset
=bt2
.ClockClassOffset(45, 3003),
148 self
.assertEqual(cc1
, cc2
)
150 def test_ne_name(self
):
151 my_uuid
= uuid
.uuid1()
152 cc1
= bt2
.CtfWriterClock(
154 description
='some description',
157 offset
=bt2
.ClockClassOffset(45, 3003),
161 cc2
= bt2
.CtfWriterClock(
163 description
='some description',
166 offset
=bt2
.ClockClassOffset(45, 3003),
170 self
.assertNotEqual(cc1
, cc2
)
172 def test_ne_description(self
):
173 my_uuid
= uuid
.uuid1()
174 cc1
= bt2
.CtfWriterClock(
176 description
='some descripti2',
179 offset
=bt2
.ClockClassOffset(45, 3003),
183 cc2
= bt2
.CtfWriterClock(
185 description
='some description',
188 offset
=bt2
.ClockClassOffset(45, 3003),
192 self
.assertNotEqual(cc1
, cc2
)
194 def test_ne_frequency(self
):
195 my_uuid
= uuid
.uuid1()
196 cc1
= bt2
.CtfWriterClock(
198 description
='some description',
201 offset
=bt2
.ClockClassOffset(45, 3003),
205 cc2
= bt2
.CtfWriterClock(
207 description
='some description',
210 offset
=bt2
.ClockClassOffset(45, 3003),
214 self
.assertNotEqual(cc1
, cc2
)
216 def test_ne_precision(self
):
217 my_uuid
= uuid
.uuid1()
218 cc1
= bt2
.CtfWriterClock(
220 description
='some description',
223 offset
=bt2
.ClockClassOffset(45, 3003),
227 cc2
= bt2
.CtfWriterClock(
229 description
='some description',
232 offset
=bt2
.ClockClassOffset(45, 3003),
236 self
.assertNotEqual(cc1
, cc2
)
238 def test_ne_offset(self
):
239 my_uuid
= uuid
.uuid1()
240 cc1
= bt2
.CtfWriterClock(
242 description
='some description',
245 offset
=bt2
.ClockClassOffset(45, 3001),
249 cc2
= bt2
.CtfWriterClock(
251 description
='some description',
254 offset
=bt2
.ClockClassOffset(45, 3003),
258 self
.assertNotEqual(cc1
, cc2
)
260 def test_ne_absolute(self
):
261 my_uuid
= uuid
.uuid1()
262 cc1
= bt2
.CtfWriterClock(
264 description
='some description',
267 offset
=bt2
.ClockClassOffset(45, 3003),
271 cc2
= bt2
.CtfWriterClock(
273 description
='some description',
276 offset
=bt2
.ClockClassOffset(45, 3003),
280 self
.assertNotEqual(cc1
, cc2
)
282 def test_ne_uuid(self
):
283 cc1
= bt2
.CtfWriterClock(
285 description
='some description',
288 offset
=bt2
.ClockClassOffset(45, 3003),
292 cc2
= bt2
.CtfWriterClock(
294 description
='some description',
297 offset
=bt2
.ClockClassOffset(45, 3003),
301 self
.assertNotEqual(cc1
, cc2
)
303 def test_eq_invalid(self
):
304 self
.assertFalse(self
._clock
== 23)
This page took 0.035682 seconds and 4 git commands to generate.