Exemplo n.º 1
0
    def test_length_arg_omitted(self):
        """
        @Test: Generate a random HTML tag and provide no value for the
            ``length`` argument.
        @Feature: HTML Generator
        @Assert: The contents of the HTML tag are at least one character long.
        """

        match = self.matcher.search(gen_html())
        self.assertGreaterEqual(len(match.group(1)), 1)
Exemplo n.º 2
0
    def test_length_arg_omitted(self):
        """
        @Test: Generate a random HTML tag and provide no value for the
            ``length`` argument.
        @Feature: HTML Generator
        @Assert: The contents of the HTML tag are at least one character long.
        """

        match = self.matcher.search(gen_html())
        self.assertGreaterEqual(len(match.group(1)), 1)
Exemplo n.º 3
0
    def test_length_arg_provided(self):
        """
        @Test: Generate a random HTML tag and provide a value for the
            ``length`` argument.
        @Feature: HTML Generator
        @Assert: The contents of the HTML tag are ``length`` characters long.
        """

        length = gen_integer(1, 25)
        match = self.matcher.search(gen_html(length))
        self.assertEqual(len(match.group(1)), length)
Exemplo n.º 4
0
    def test_length_arg_provided(self):
        """
        @Test: Generate a random HTML tag and provide a value for the
            ``length`` argument.
        @Feature: HTML Generator
        @Assert: The contents of the HTML tag are ``length`` characters long.
        """

        length = gen_integer(1, 25)
        match = self.matcher.search(gen_html(length))
        self.assertEqual(len(match.group(1)), length)
Exemplo n.º 5
0
    def test_unicode(self):
        """
        @Test: Generate a random HTML tag.
        @Feature: HTML Generator
        @Assert: A unicode string is generated.
        """

        result = gen_html()
        if sys.version_info[0] is 2:
            # (undefined-variable) pylint:disable=E0602
            self.assertIsInstance(result, unicode)  # flake8:noqa
        else:
            self.assertIsInstance(result, str)
Exemplo n.º 6
0
    def test_unicode(self):
        """
        @Test: Generate a random HTML tag.
        @Feature: HTML Generator
        @Assert: A unicode string is generated.
        """

        result = gen_html()
        if sys.version_info[0] is 2:
            # (undefined-variable) pylint:disable=E0602
            self.assertIsInstance(result, unicode)  # flake8:noqa
        else:
            self.assertIsInstance(result, str)
Exemplo n.º 7
0
def test_generate_html_with_len_more_than_min(length):
    """Cannot generate a HTML string with length more than minimum."""
    assert length == len(gen_html(length, include_tags=False))
Exemplo n.º 8
0
def test_generate_html_with_len_less_than_min():
    """Cannot generate a HTML string with length less than minimum."""
    for value in range(8):
        with pytest.raises(ValueError):
            gen_html(value, include_tags=False)
Exemplo n.º 9
0
def test_unicode():
    """Generate a random HTML tag."""
    assert isinstance(gen_html(), str)
Exemplo n.º 10
0
def test_length_arg_provided(matcher):
    """Generate a random HTML tag with ``length`` argument."""
    length = gen_integer(1, 25)
    match = matcher.search(gen_html(length))
    assert len(match.group(1)) == length
Exemplo n.º 11
0
def test_length_arg_omitted(matcher):
    """Generate a random HTML tag with no ``length`` argument."""
    match = matcher.search(gen_html())
    assert len(match.group(1)) >= 1