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)
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')
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)
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
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")
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")
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")
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")
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")
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")
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" )
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"))
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"))
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
def description(): """Return a generic text suitable to mimic a ``Fact.description``.""" return fauxfactory.gen_iplum()
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
def test_gen_loremipsum_9(): """Create a lorem ipsum string with non-integer paragraphs.""" with pytest.raises(ValueError): gen_iplum(paragraphs='a')
def test_gen_loremipsum_8(): """Create a lorem ipsum string with non-integer words.""" with pytest.raises(ValueError): gen_iplum(words='a')
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
def test_gen_loremipsum_1(): """Create a complete lorem ipsum string.""" result = gen_iplum() assert result == LOREM_IPSUM_TEXT assert result.startswith('Lorem ipsum')
def test_gen_loremipsum_4(): """Create a lorem ipsum string with zero words.""" result = gen_iplum(words=0) assert result == LOREM_IPSUM_TEXT
def test_gen_loremipsum_5(): """Create a lorem ipsum string with zero paragraphs.""" with pytest.raises(ValueError): gen_iplum(paragraphs=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
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)