Exemplo n.º 1
0
    def test_gen_loremipsum_6(self):
        """
        @Test: Create a lorem ipsum string with 1 word and 0 paragragh
        @Feature: Lorem Ipsum Generator
        @Assert: Raise ValueError
        """

        with self.assertRaises(ValueError):
            gen_iplum(words=1, paragraphs=0)
Exemplo n.º 2
0
    def test_gen_loremipsum_8(self):
        """
        @Test: Create a lorem ipsum string with non-integer words
        @Feature: Lorem Ipsum Generator
        @Assert: Raises ValueError
        """

        with self.assertRaises(ValueError):
            gen_iplum(words='a')
Exemplo n.º 3
0
    def test_gen_loremipsum_5(self):
        """
        @Test: Create a lorem ipsum string with zero paragraphs
        @Feature: Lorem Ipsum Generator
        @Assert: Raises ValueError
        """

        with self.assertRaises(ValueError):
            gen_iplum(paragraphs=0)
Exemplo n.º 4
0
    def test_gen_loremipsum_8(self):
        """
        @Test: Create a lorem ipsum string with non-integer words
        @Feature: Lorem Ipsum Generator
        @Assert: Raises ValueError
        """

        with self.assertRaises(ValueError):
            gen_iplum(words='a')
Exemplo n.º 5
0
    def test_gen_loremipsum_6(self):
        """
        @Test: Create a lorem ipsum string with 1 word and 0 paragragh
        @Feature: Lorem Ipsum Generator
        @Assert: Raise ValueError
        """

        with self.assertRaises(ValueError):
            gen_iplum(words=1, paragraphs=0)
Exemplo n.º 6
0
    def test_gen_loremipsum_5(self):
        """
        @Test: Create a lorem ipsum string with zero paragraphs
        @Feature: Lorem Ipsum Generator
        @Assert: Raises ValueError
        """

        with self.assertRaises(ValueError):
            gen_iplum(paragraphs=0)
Exemplo n.º 7
0
def test_gen_loremipsum_10():
    """Create a lorem ipsum string with random words/paragraphs."""
    for _ in range(20):
        words = random.randint(1, 500)
        paragraphs = random.randint(1, 500)
        result = gen_iplum(words=words, paragraphs=paragraphs)
        assert len(result.split('\n')) == paragraphs
        for sentence in result.split('\n'):
            assert len(sentence.split()) == words
Exemplo n.º 8
0
    def test_gen_loremipsum_4(self):
        """
        @Test: Create a lorem ipsum string with zero words
        @Feature: Lorem Ipsum Generator
        @Assert: Complete lorem ipsum value is returned
        """

        result = gen_iplum(words=0)
        self.assertEqual(result, LOREM_IPSUM_TEXT,
                         "Generated text is not Lorem Ipsum")
Exemplo n.º 9
0
    def test_gen_loremipsum_7(self):
        """
        @Test: Create a lorem ipsum string with 1 word and 1 paragragh
        @Feature: Lorem Ipsum Generator
        @Assert: Generated string has 1 word in 1 paragraph
        """

        result = gen_iplum(words=1, paragraphs=1)
        self.assertEqual(len(result.split()), 1, "String is not 1-word long")
        self.assertEqual(len(result.split()), 1,
                         "String is not 1-paragraph long")
Exemplo n.º 10
0
    def test_gen_loremipsum_7(self):
        """
        @Test: Create a lorem ipsum string with 1 word and 1 paragragh
        @Feature: Lorem Ipsum Generator
        @Assert: Generated string has 1 word in 1 paragraph
        """

        result = gen_iplum(words=1, paragraphs=1)
        self.assertEqual(len(result.split()), 1, "String is not 1-word long")
        self.assertEqual(
            len(result.split()), 1, "String is not 1-paragraph long")
Exemplo n.º 11
0
    def test_gen_loremipsum_4(self):
        """
        @Test: Create a lorem ipsum string with zero words
        @Feature: Lorem Ipsum Generator
        @Assert: Complete lorem ipsum value is returned
        """

        result = gen_iplum(words=0)
        self.assertEqual(
            result,
            LOREM_IPSUM_TEXT, "Generated text is not Lorem Ipsum")
Exemplo n.º 12
0
    def test_gen_loremipsum_1(self):
        """
        @Test: Create a complete lorem ipsum string
        @Feature: Lorem Ipsum Generator
        @Assert: Complete lorem ipsum value that starts with 'Lorem ipsum'
        """

        result = gen_iplum()
        self.assertEqual(result, LOREM_IPSUM_TEXT,
                         "Generated text is not Lorem Ipsum")
        self.assertTrue(result.startswith('Lorem ipsum'),
                        "Generated string does not start with Lorem Ipsum")
Exemplo n.º 13
0
    def test_gen_loremipsum_2(self):
        """
        @Test: Create a lorem ipsum string with fixed number of words
        @Feature: Lorem Ipsum Generator
        @Assert: lorem ipsum value has exact number of words
        """

        for i in range(20):
            length = random.randint(1, 500)
            result = gen_iplum(words=length)
            self.assertEqual(
                len(result.split()), length,
                "Generated string does not have the correct number of words")
Exemplo n.º 14
0
    def test_gen_loremipsum_2(self):
        """
        @Test: Create a lorem ipsum string with fixed number of words
        @Feature: Lorem Ipsum Generator
        @Assert: lorem ipsum value has exact number of words
        """

        for i in range(20):
            length = random.randint(1, 500)
            result = gen_iplum(words=length)
            self.assertEqual(
                len(result.split()),
                length,
                "Generated string does not have the correct number of words")
Exemplo n.º 15
0
    def test_gen_loremipsum_1(self):
        """
        @Test: Create a complete lorem ipsum string
        @Feature: Lorem Ipsum Generator
        @Assert: Complete lorem ipsum value that starts with 'Lorem ipsum'
        """

        result = gen_iplum()
        self.assertEqual(
            result,
            LOREM_IPSUM_TEXT, "Generated text is not Lorem Ipsum")
        self.assertTrue(
            result.startswith('Lorem ipsum'),
            "Generated string does not start with Lorem Ipsum"
        )
Exemplo n.º 16
0
    def test_gen_loremipsum_10(self):
        """
        @Test: Create a lorem ipsum string with random words/paragraphs
        @Feature: Lorem Ipsum Generator
        @Assert: lorem ipsum value has exact number of words/paragraphs
        """

        for i in range(20):
            words = random.randint(1, 500)
            paragraphs = random.randint(1, 500)
            result = gen_iplum(words=words, paragraphs=paragraphs)
            self.assertEqual(
                len(result.split('\n')), paragraphs,
                ("Generated string does not have the correct number"
                 "of paragraphs"))
            for sentence in result.split('\n'):
                self.assertEqual(len(sentence.split()), words,
                                 ("Generated string does not have the correct"
                                  "number of words"))
Exemplo n.º 17
0
    def test_gen_loremipsum_10(self):
        """
        @Test: Create a lorem ipsum string with random words/paragraphs
        @Feature: Lorem Ipsum Generator
        @Assert: lorem ipsum value has exact number of words/paragraphs
        """

        for i in range(20):
            words = random.randint(1, 500)
            paragraphs = random.randint(1, 500)
            result = gen_iplum(
                words=words, paragraphs=paragraphs)
            self.assertEqual(
                len(result.split('\n')),
                paragraphs,
                ("Generated string does not have the correct number"
                 "of paragraphs"))
            for sentence in result.split('\n'):
                self.assertEqual(
                    len(sentence.split()),
                    words,
                    ("Generated string does not have the correct"
                     "number of words"))
Exemplo n.º 18
0
def basic_table():
    ncols = random.randint(3, 5)
    nrows = random.randint(3, 5)

    headers = []
    for ncol in range(ncols):
        header = fauxfactory.gen_string('alphanumeric')
        headers.append(header)

    rows = []
    for nrow in range(nrows):
        row = []
        for ncol in range(ncols):
            if ncol == 0:
                cell = fauxfactory.gen_iplum(words=10, paragraphs=1)
            elif ncol == 1:
                cell = fauxfactory.gen_integer()
            else:
                cell = fauxfactory.gen_string('utf8')
            row.append(cell)
        rows.append(row)

    return rows, headers
Exemplo n.º 19
0
def description():
    """Return a generic text suitable to mimic a ``Fact.description``."""
    return fauxfactory.gen_iplum()
Exemplo n.º 20
0
def test_gen_loremipsum_3():
    """Create a lorem ipsum string with fixed number of paragraphs."""
    for _ in range(20):
        length = random.randint(1, 20)
        result = gen_iplum(paragraphs=length)
        assert len(result.split('\n')) == length
Exemplo n.º 21
0
def test_gen_loremipsum_9():
    """Create a lorem ipsum string with non-integer paragraphs."""
    with pytest.raises(ValueError):
        gen_iplum(paragraphs='a')
Exemplo n.º 22
0
def test_gen_loremipsum_8():
    """Create a lorem ipsum string with non-integer words."""
    with pytest.raises(ValueError):
        gen_iplum(words='a')
Exemplo n.º 23
0
def test_gen_loremipsum_7():
    """Create a lorem ipsum string with 1 word and 1 paragragh."""
    result = gen_iplum(words=1, paragraphs=1)
    assert len(result.split()) == 1
    assert len(result.split()) == 1
Exemplo n.º 24
0
def test_gen_loremipsum_1():
    """Create a complete lorem ipsum string."""
    result = gen_iplum()
    assert result == LOREM_IPSUM_TEXT
    assert result.startswith('Lorem ipsum')
Exemplo n.º 25
0
def test_gen_loremipsum_4():
    """Create a lorem ipsum string with zero words."""
    result = gen_iplum(words=0)
    assert result == LOREM_IPSUM_TEXT
Exemplo n.º 26
0
def test_gen_loremipsum_5():
    """Create a lorem ipsum string with zero paragraphs."""
    with pytest.raises(ValueError):
        gen_iplum(paragraphs=0)
Exemplo n.º 27
0
def test_gen_loremipsum_2():
    """Create a lorem ipsum string with fixed number of words."""
    for _ in range(20):
        length = random.randint(1, 500)
        result = gen_iplum(words=length)
        assert len(result.split()) == length
Exemplo n.º 28
0
def test_gen_loremipsum_6():
    """Create a lorem ipsum string with 1 word and 0 paragragh."""
    with pytest.raises(ValueError):
        gen_iplum(words=1, paragraphs=0)
Exemplo n.º 29
0
def description():
    """Return a generic text suitable to mimic a ``Fact.description``."""
    return fauxfactory.gen_iplum()