How to use the pycaption.DFXPWriter function in pycaption

To help you get started, we’ve selected a few pycaption examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github pbs / pycaption / tests / test_srt_conversion.py View on Github external
def test_srt_to_dfxp_conversion(self):
        caption_set = SRTReader().read(SAMPLE_SRT)
        results = DFXPWriter().write(caption_set)
        self.assertTrue(isinstance(results, six.text_type))
        self.assertDFXPEquals(
            SAMPLE_DFXP, results,
            ignore_styling=True, ignore_spans=True
        )
github pbs / pycaption / tests / test_sami_conversion.py View on Github external
def test_sami_to_dfxp_with_bad_span_align(self):
        caption_set = SAMIReader().read(SAMPLE_SAMI_WITH_BAD_SPAN_ALIGN)
        results = DFXPWriter(
            relativize=False, fit_to_screen=False).write(caption_set)
        self.assertDFXPEquals(
            SAMPLE_DFXP_FROM_SAMI_WITH_BAD_SPAN_ALIGN,
            results
        )
github pbs / pycaption / tests / test_dfxp_conversion.py View on Github external
def test_dont_create_style_tags_with_no_id(self):
        # The 
github pbs / pycaption / tests / test_dfxp_conversion.py View on Github external
def test_fit_to_screen(self):
        # Check if caption width and height are is explicitly set and
        # recalculate it if necessary. This prevents long captions from being
        # cut out of the screen.
        caption_set = DFXPReader().read(SAMPLE_DFXP_LONG_CUE)
        result = DFXPWriter().write(caption_set)
        self.assertEqual(result, SAMPLE_DFXP_LONG_CUE_FIT_TO_SCREEN)
github pbs / pycaption / tests / test_scc_conversion.py View on Github external
def test_scc_to_dfxp(self):
        caption_set = SCCReader().read(SAMPLE_SCC_MULTIPLE_POSITIONING)
        dfxp = DFXPWriter(
            relativize=False, fit_to_screen=False).write(caption_set)
        self.assertEqual(SAMPLE_DFXP_FROM_SCC_OUTPUT, dfxp)
github pbs / pycaption / tests / test_sami_conversion.py View on Github external
def test_sami_to_dfxp_with_margin_for_language(self):
        caption_set = SAMIReader().read(SAMPLE_SAMI_LANG_MARGIN)
        results = DFXPWriter(
            relativize=False, fit_to_screen=False).write(caption_set)
        self.assertDFXPEquals(
            SAMPLE_DFXP_FROM_SAMI_WITH_LANG_MARGINS,
            results
        )
github pbs / pycaption / tests / test_dfxp_conversion.py View on Github external
def test_default_styling_p_tags(self):
        caption_set = DFXPReader().read(SAMPLE_DFXP)
        result = DFXPWriter().write(caption_set)

        soup = BeautifulSoup(result, 'lxml')
        for p in soup.find_all('p'):
            self.assertEqual(p.attrs.get('style'), 'p')
github pbs / pycaption / tests / test_dfxp_conversion.py View on Github external
def test_correct_region_attributes_are_recreated(self):
        caption_set = DFXPReader().read(SAMPLE_DFXP_MULTIPLE_REGIONS_INPUT)
        result = DFXPWriter(
            relativize=False, fit_to_screen=False).write(caption_set)
        self.assertDFXPEquals(result, SAMPLE_DFXP_MULTIPLE_REGIONS_OUTPUT)
github pbs / pycaption / tests / test_dfxp_conversion.py View on Github external
def test_dfxp_to_dfxp_conversion(self):
        caption_set = DFXPReader().read(SAMPLE_DFXP)
        results = DFXPWriter().write(caption_set)
        self.assertTrue(isinstance(results, text_type))
        self.assertDFXPEquals(SAMPLE_DFXP_OUTPUT, results)
github pbs / pycaption / tests / test_sami_conversion.py View on Github external
def test_sami_to_dfxp_conversion(self):
        caption_set = SAMIReader().read(SAMPLE_SAMI)
        results = DFXPWriter(relativize=False,
                             fit_to_screen=False).write(caption_set)
        self.assertTrue(isinstance(results, six.text_type))
        self.assertDFXPEquals(
            DFXP_FROM_SAMI_WITH_POSITIONING,
            results
        )