MCPcopy Create free account
hub / github.com/Breakthrough/PySceneDetect / test_equality

Function test_equality

tests/test_timecode.py:268–304  ·  view source on GitHub ↗

Test FrameTimecode equality (==, __eq__) operator.

()

Source from the content-addressed store, hash-verified

266
267
268def test_equality():
269 """Test FrameTimecode equality (==, __eq__) operator."""
270 x = FrameTimecode(timecode=1.0, fps=10.0)
271 assert x == x
272 assert x == FrameTimecode(timecode=1.0, fps=10.0)
273 assert x == FrameTimecode(timecode=1.0, fps=10.0)
274 assert x == FrameTimecode(timecode=1.0, fps=Fraction(10, 1))
275 assert x != FrameTimecode(timecode=10.0, fps=10.0)
276 assert x != FrameTimecode(timecode=10.0, fps=10.0)
277 assert x != FrameTimecode(timecode=10.0, fps=Fraction(100, 10))
278 assert x == FrameTimecode(x)
279 assert x == FrameTimecode(1.0, x)
280 assert x == FrameTimecode(10, x)
281 assert x == "00:00:01"
282 assert x == "00:00:01.0"
283 assert x == "00:00:01.00"
284 assert x == "00:00:01.000"
285 assert x == "00:00:01.0000"
286 assert x == "00:00:01.00000"
287 assert x == 10
288 assert x == 1.0
289
290 with pytest.raises(ValueError):
291 assert x == "0x"
292 with pytest.raises(ValueError):
293 assert x == "x00:00:00.000"
294 with pytest.raises(TypeError):
295 assert x == [0]
296 with pytest.raises(TypeError):
297 assert x == (0,)
298 with pytest.raises(TypeError):
299 assert x == [0, 1, 2, 3]
300 with pytest.raises(TypeError):
301 assert x == {0: 0}
302
303 assert FrameTimecode(timecode="00:00:00.5", fps=10.0) == "00:00:00.500"
304 assert FrameTimecode(timecode="00:00:01.500", fps=10.0) == "00:00:01.500"
305
306
307def test_addition():

Callers

nothing calls this directly

Calls 1

FrameTimecodeClass · 0.90

Tested by

no test coverage detected