Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
OlteanuRares committed Feb 1, 2024
1 parent 57d62ea commit e76a815
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 11 deletions.
7 changes: 3 additions & 4 deletions pycaption/scc/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@
from copy import deepcopy

from pycaption.base import (
BaseReader, BaseWriter, CaptionSet, CaptionNode,
BaseReader, BaseWriter, CaptionSet
)
from pycaption.exceptions import CaptionReadNoCaptions, InvalidInputError, \
CaptionReadTimingError, CaptionLineLengthError
Expand All @@ -94,7 +94,7 @@
MICROSECONDS_PER_CODEWORD, CHARACTER_TO_CODE,
SPECIAL_OR_EXTENDED_CHAR_TO_CODE, PAC_BYTES_TO_POSITIONING_MAP,
PAC_HIGH_BYTE_BY_ROW, PAC_LOW_BYTE_BY_ROW_RESTRICTED,
PAC_TAB_OFFSET_COMMANDS, COMMANDS_WITHOUT_INCREMENT_FRAMES
PAC_TAB_OFFSET_COMMANDS
)
from .specialized_collections import ( # noqa: F401
TimingCorrectingCaptionList, NotifyingDict, CaptionCreator,
Expand Down Expand Up @@ -330,8 +330,7 @@ def _translate_word(self, word):
self._translate_characters(word)

# count frames for timing only after processing a command
if word not in COMMANDS_WITHOUT_INCREMENT_FRAMES:
self.time_translator.increment_frames()
self.time_translator.increment_frames()

def _handle_double_command(self, word):
# If the caption is to be broadcast, each of the commands are doubled
Expand Down
6 changes: 0 additions & 6 deletions pycaption/scc/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -1047,9 +1047,3 @@ def _restructure_bytes_to_position_map(byte_to_pos_map):
'└': ["+"],
'┘': ["+"]
}
POP_ROLL_PAINT = ['9420', '9429', '9425', '9426', '94a7']
END_OF_CAPTION = ['942f']
ERASE_DISPLAYED_MEMORY = ['942c']
COMMANDS_WITHOUT_INCREMENT_FRAMES = (
POP_ROLL_PAINT + END_OF_CAPTION + ERASE_DISPLAYED_MEMORY
)
6 changes: 5 additions & 1 deletion tests/test_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,4 +66,8 @@ class TestBaseReader:
def test_get_initial_timestamp_dfxp(self, sample_dfxp):
assert DFXPReader().get_initial_timestamp(sample_dfxp) == "00:00:09.209"


def test_get_initial_timestamp_sami(self, sample_sami):
assert SAMIReader().get_initial_timestamp(sample_sami) == "00:00:09.209"

def test_get_initial_timestamp_scc(self, sample_scc_pop_on):
assert SCCReader().get_initial_timestamp(sample_scc_pop_on) == "00:00:09.743"

0 comments on commit e76a815

Please sign in to comment.