Esempio n. 1
0
def test_from_rawlog():
    str_full = " 0  00:00.00  null  either "
    str_mark = "    1     0:00.03    video start"

    rawlog = RawLog()
    rawlog.full.append(str_full)
    rawlog.marks.append(str_mark)

    log = Log.from_raw_log(rawlog)

    assert log.full == [BehaviorFull(" 0  00:00.00  null  either ")]
    assert log.marks == [Mark.from_line("    1     0:00.03    video start")]
Esempio n. 2
0
def test_from_line_valid_negative_frame():
    Mark.from_line("    -1     0:00.03    video start")
Esempio n. 3
0
def test_from_line_invalid_time_one_middle_digit():
    with pytest.raises(TypeError):
        Mark.from_line("    1     0:0.03    video start")
Esempio n. 4
0
def test_from_line_invalid_time_two_periods():
    with pytest.raises(TypeError):
        Mark.from_line("    1     0.00.03    video start")
Esempio n. 5
0
def test_from_line_invalid_time_no_period():
    with pytest.raises(TypeError):
        Mark.from_line("    1     0:00:03    video start")
Esempio n. 6
0
def test_from_line_invalid_one_space_after_frame():
    with pytest.raises(TypeError):
        Mark.from_line("    1 0:00.03    video start")
Esempio n. 7
0
def test_to_line_valid_end_start_is_template():
    start = "    1     0:00.03    video start"
    end = "54001    30:00.03    video end"
    mark = Mark.from_line(end)
    assert mark.to_line(start) == end
Esempio n. 8
0
def test_from_line_invalid_name():
    with pytest.raises(TypeError):
        Mark.from_line("    1     0:00.03    video start!")
Esempio n. 9
0
def test_lt_name():
    first = Mark.from_line("    1     0:00.03    a video starts")
    second = Mark.from_line("    1     0:00.03    video start")

    assert first < second
Esempio n. 10
0
def test_lt_time_both_signs():
    first = Mark.from_line("    1     -0:00.03    video start")
    second = Mark.from_line("    1     0:00.03    video start")

    assert first < second
Esempio n. 11
0
def test_lt_time_negative():
    first = Mark.from_line("    1     -0:05.00    video start")
    second = Mark.from_line("    1     -0:00.03    video start")

    assert first < second
Esempio n. 12
0
def test_from_line_valid_end():
    mark = Mark.from_line("54001    30:00.03    video end")
    assert mark.frame == 54001
    assert mark.time == timedelta(seconds=1800.03)
    assert mark.name == "video end"
Esempio n. 13
0
def test_lt_frame_negative():
    first = Mark.from_line("    -2     0:00.03    video start")
    second = Mark.from_line("    -1     0:00.03    video start")

    assert first < second
Esempio n. 14
0
def test_lt_frame_positive():
    first = Mark.from_line("    1     0:00.03    video start")
    second = Mark.from_line("    2     0:00.03    video start")

    assert first < second
Esempio n. 15
0
def test_from_line_valid_start():
    mark = Mark.from_line("    1     0:00.03    video start")
    assert mark.frame == 1
    assert mark.time == timedelta(seconds=0.03)
    assert mark.name == "video start"
Esempio n. 16
0
def test_from_line_valid_time_negative():
    Mark.from_line("    1     -0:00.03    video start")
Esempio n. 17
0
def test_from_line_invalid_time_nonnumeric():
    with pytest.raises(TypeError):
        Mark.from_line("    1     0:a00.03    video start")
Esempio n. 18
0
def test_lt_name_lexicographic():
    first = Mark.from_line("    1     0:00.03    A video starts")
    second = Mark.from_line("    1     0:00.03    video starts")

    assert first < second
Esempio n. 19
0
def test_from_line_valid_long_time():
    mark = Mark.from_line("    1     01:20:04.03    video start")
    assert mark.frame == 1
    assert mark.time == timedelta(seconds=(1 * 60 * 60 + 20 * 60 + 4.03))
    assert mark.name == "video start"
Esempio n. 20
0
def test_lt_equal():
    first = Mark.from_line("    1     0:00.03    A video starts")
    second = Mark.from_line("    1     0:00.03    A video starts")

    assert first >= second