Exemplo n.º 1
0
    def test_get_text_from_shapes_with_no_shapes(self):
        """
        Test getting text from powerpoint shapes with no shapes
        """
        # GIVEN: empty shapes array
        shapes = []

        # WHEN: getting the text
        result = _get_text_from_shapes(shapes)

        # THEN: it should not fail but return empty string
        self.assertEqual(result, '', 'result should be empty')
    def get_text_from_shapes_with_no_shapes_test(self):
        """
        Test getting text from powerpoint shapes with no shapes
        """
        # GIVEN: empty shapes array
        shapes = []

        # WHEN: getting the text
        result = _get_text_from_shapes(shapes)

        # THEN: it should not fail but return empty string
        self.assertEqual(result, '', 'result should be empty')
Exemplo n.º 3
0
    def test_get_text_from_shapes(self):
        """
        Test getting text from powerpoint shapes
        """
        # GIVEN: mocked shapes
        shape = MagicMock()
        shape.PlaceholderFormat.Type = 2
        shape.HasTextFrame = shape.TextFrame.HasText = True
        shape.TextFrame.TextRange.Text = 'slideText'
        shapes = [shape, shape]

        # WHEN: getting the text
        result = _get_text_from_shapes(shapes)

        # THEN: it should return the text
        self.assertEqual(result, 'slideText\nslideText\n', 'result should match \'slideText\nslideText\n\'')
    def get_text_from_shapes_test(self):
        """
        Test getting text from powerpoint shapes
        """
        # GIVEN: mocked shapes
        shape = MagicMock()
        shape.PlaceholderFormat.Type = 2
        shape.HasTextFrame = shape.TextFrame.HasText = True
        shape.TextFrame.TextRange.Text = 'slideText'
        shapes = [shape, shape]

        # WHEN: getting the text
        result = _get_text_from_shapes(shapes)

        # THEN: it should return the text
        self.assertEqual(result, 'slideText\nslideText\n', 'result should match \'slideText\nslideText\n\'')