7 @unittest.skip("this is broken")
8 class CtfWriterClockTestCase(unittest
.TestCase
):
10 self
._clock
= bt2
.CtfWriterClock('salut')
15 def test_create_default(self
):
16 self
.assertEqual(self
._clock
.name
, 'salut')
18 def test_create_invalid_no_name(self
):
19 with self
.assertRaises(TypeError):
22 def test_create_full(self
):
23 my_uuid
= uuid
.uuid1()
24 cc
= bt2
.CtfWriterClock(name
='name', description
='some description',
25 frequency
=1001, precision
=176,
26 offset
=bt2
.ClockClassOffset(45, 3003),
27 is_absolute
=True, uuid
=my_uuid
)
28 self
.assertEqual(cc
.name
, 'name')
29 self
.assertEqual(cc
.description
, 'some description')
30 self
.assertEqual(cc
.frequency
, 1001)
31 self
.assertEqual(cc
.precision
, 176)
32 self
.assertEqual(cc
.offset
, bt2
.ClockClassOffset(45, 3003))
33 self
.assertEqual(cc
.is_absolute
, True)
34 self
.assertEqual(cc
.uuid
, copy
.deepcopy(my_uuid
))
36 def test_assign_description(self
):
37 self
._clock
.description
= 'hi people'
38 self
.assertEqual(self
._clock
.description
, 'hi people')
40 def test_assign_invalid_description(self
):
41 with self
.assertRaises(TypeError):
42 self
._clock
.description
= 23
44 def test_assign_frequency(self
):
45 self
._clock
.frequency
= 987654321
46 self
.assertEqual(self
._clock
.frequency
, 987654321)
48 def test_assign_invalid_frequency(self
):
49 with self
.assertRaises(TypeError):
50 self
._clock
.frequency
= 'lel'
52 def test_assign_precision(self
):
53 self
._clock
.precision
= 12
54 self
.assertEqual(self
._clock
.precision
, 12)
56 def test_assign_invalid_precision(self
):
57 with self
.assertRaises(TypeError):
58 self
._clock
.precision
= 'lel'
60 def test_assign_offset(self
):
61 self
._clock
.offset
= bt2
.ClockClassOffset(12, 56)
62 self
.assertEqual(self
._clock
.offset
, bt2
.ClockClassOffset(12, 56))
64 def test_assign_invalid_offset(self
):
65 with self
.assertRaises(TypeError):
66 self
._clock
.offset
= object()
68 def test_assign_absolute(self
):
69 self
._clock
.is_absolute
= True
70 self
.assertTrue(self
._clock
.is_absolute
)
72 def test_assign_invalid_absolute(self
):
73 with self
.assertRaises(TypeError):
74 self
._clock
.is_absolute
= 23
76 def test_assign_uuid(self
):
77 the_uuid
= uuid
.uuid1()
78 self
._clock
.uuid
= the_uuid
79 self
.assertEqual(self
._clock
.uuid
, the_uuid
)
81 def test_assign_invalid_uuid(self
):
82 with self
.assertRaises(TypeError):
83 self
._clock
.uuid
= object()
85 def test_assign_time(self
):
86 self
._clock
.time
= 41232
88 def test_assign_invalid_time(self
):
89 with self
.assertRaises(TypeError):
90 self
._clock
.time
= object()
92 def _test_copy(self
, cpy
):
93 self
.assertIsNot(cpy
, self
._clock
)
94 self
.assertNotEqual(cpy
.addr
, self
._clock
.addr
)
95 self
.assertEqual(cpy
, self
._clock
)
98 cpy
= copy
.copy(self
._clock
)
101 def test_deepcopy(self
):
102 cpy
= copy
.deepcopy(self
._clock
)
106 my_uuid
= uuid
.uuid1()
107 cc1
= bt2
.CtfWriterClock(name
='name', description
='some description',
108 frequency
=1001, precision
=176,
109 offset
=bt2
.ClockClassOffset(45, 3003),
110 is_absolute
=True, uuid
=my_uuid
)
111 cc2
= bt2
.CtfWriterClock(name
='name', description
='some description',
112 frequency
=1001, precision
=176,
113 offset
=bt2
.ClockClassOffset(45, 3003),
114 is_absolute
=True, uuid
=my_uuid
)
115 self
.assertEqual(cc1
, cc2
)
117 def test_ne_name(self
):
118 my_uuid
= uuid
.uuid1()
119 cc1
= bt2
.CtfWriterClock(name
='mane', description
='some description',
120 frequency
=1001, precision
=176,
121 offset
=bt2
.ClockClassOffset(45, 3003),
122 is_absolute
=True, uuid
=my_uuid
)
123 cc2
= bt2
.CtfWriterClock(name
='name', description
='some description',
124 frequency
=1001, precision
=176,
125 offset
=bt2
.ClockClassOffset(45, 3003),
126 is_absolute
=True, uuid
=my_uuid
)
127 self
.assertNotEqual(cc1
, cc2
)
129 def test_ne_description(self
):
130 my_uuid
= uuid
.uuid1()
131 cc1
= bt2
.CtfWriterClock(name
='name', description
='some descripti2',
132 frequency
=1001, precision
=176,
133 offset
=bt2
.ClockClassOffset(45, 3003),
134 is_absolute
=True, uuid
=my_uuid
)
135 cc2
= bt2
.CtfWriterClock(name
='name', description
='some description',
136 frequency
=1001, precision
=176,
137 offset
=bt2
.ClockClassOffset(45, 3003),
138 is_absolute
=True, uuid
=my_uuid
)
139 self
.assertNotEqual(cc1
, cc2
)
141 def test_ne_frequency(self
):
142 my_uuid
= uuid
.uuid1()
143 cc1
= bt2
.CtfWriterClock(name
='name', description
='some description',
144 frequency
=1003, precision
=176,
145 offset
=bt2
.ClockClassOffset(45, 3003),
146 is_absolute
=True, uuid
=my_uuid
)
147 cc2
= bt2
.CtfWriterClock(name
='name', description
='some description',
148 frequency
=1001, precision
=176,
149 offset
=bt2
.ClockClassOffset(45, 3003),
150 is_absolute
=True, uuid
=my_uuid
)
151 self
.assertNotEqual(cc1
, cc2
)
153 def test_ne_precision(self
):
154 my_uuid
= uuid
.uuid1()
155 cc1
= bt2
.CtfWriterClock(name
='name', description
='some description',
156 frequency
=1001, precision
=171,
157 offset
=bt2
.ClockClassOffset(45, 3003),
158 is_absolute
=True, uuid
=my_uuid
)
159 cc2
= bt2
.CtfWriterClock(name
='name', description
='some description',
160 frequency
=1001, precision
=176,
161 offset
=bt2
.ClockClassOffset(45, 3003),
162 is_absolute
=True, uuid
=my_uuid
)
163 self
.assertNotEqual(cc1
, cc2
)
165 def test_ne_offset(self
):
166 my_uuid
= uuid
.uuid1()
167 cc1
= bt2
.CtfWriterClock(name
='name', description
='some description',
168 frequency
=1001, precision
=176,
169 offset
=bt2
.ClockClassOffset(45, 3001),
170 is_absolute
=True, uuid
=my_uuid
)
171 cc2
= bt2
.CtfWriterClock(name
='name', description
='some description',
172 frequency
=1001, precision
=176,
173 offset
=bt2
.ClockClassOffset(45, 3003),
174 is_absolute
=True, uuid
=my_uuid
)
175 self
.assertNotEqual(cc1
, cc2
)
177 def test_ne_absolute(self
):
178 my_uuid
= uuid
.uuid1()
179 cc1
= bt2
.CtfWriterClock(name
='name', description
='some description',
180 frequency
=1001, precision
=176,
181 offset
=bt2
.ClockClassOffset(45, 3003),
182 is_absolute
=True, uuid
=my_uuid
)
183 cc2
= bt2
.CtfWriterClock(name
='name', description
='some description',
184 frequency
=1001, precision
=176,
185 offset
=bt2
.ClockClassOffset(45, 3003),
186 is_absolute
=False, uuid
=my_uuid
)
187 self
.assertNotEqual(cc1
, cc2
)
189 def test_ne_uuid(self
):
190 cc1
= bt2
.CtfWriterClock(name
='name', description
='some description',
191 frequency
=1001, precision
=176,
192 offset
=bt2
.ClockClassOffset(45, 3003),
193 is_absolute
=True, uuid
=uuid
.uuid1())
194 cc2
= bt2
.CtfWriterClock(name
='name', description
='some description',
195 frequency
=1001, precision
=176,
196 offset
=bt2
.ClockClassOffset(45, 3003),
197 is_absolute
=True, uuid
=uuid
.uuid1())
198 self
.assertNotEqual(cc1
, cc2
)
200 def test_eq_invalid(self
):
201 self
.assertFalse(self
._clock
== 23)
This page took 0.033981 seconds and 4 git commands to generate.