def test_csv_ingestor__parse__complete(self): """Test CSV file ingestor, parse function.""" result = CSVIngestor.parse(TestQuoteEngine.quote_csv_file) self.assertEqual(len(result), 2) self.assertEqual(result[0].__repr__(), '"Chase the mailman" - Skittle') self.assertEqual(result[1].__repr__(), '"When in doubt, go shoe-shopping" - Mr. Paws')
from QuoteEngine import CSVIngestor, DocxIngestor, PDFIngestor, TXTIngestor from QuoteEngine import Ingestor from MemeEngine import MemeEngine if __name__ == '__main__': base_path = '/Users/Neeraj/Development/meme_generator/_data/DogQuotes/' print(CSVIngestor.parse(base_path + 'DogQuotesCSV.csv')) print(DocxIngestor.parse(base_path + 'DogQuotesDOCX.docx')) print(PDFIngestor.parse(base_path + 'DogQuotesPDF.pdf')) print(TXTIngestor.parse(base_path + 'DogQuotesTXT.txt')) print(Ingestor.Ingestor.parse(base_path + 'DogQuotesCSV.csv')) meme_gen = MemeEngine('/Users/Neeraj/Development/meme_generator/_data') output = meme_gen.make_meme('./_data/photos/dog/xander_1.jpg', 'Hello World!', 'Macbook Pro') print(output)
def test_csv_ingestor_parse(): assert CSVIngestor.parse(TEST_CSV) == TEST_QUOTES
def test_csv_ingestor_can_ingest_non_csv(): assert not CSVIngestor.can_ingest('file.pdf')
def test_csv_ingestor_can_ingest_csv(): assert CSVIngestor.can_ingest('file.csv')
def test_csv_ingestor__can_ingest__false(self): """Test CSV file ingestor, can_ingest function.""" result = CSVIngestor.can_ingest(TestQuoteEngine.quote_txt_file) self.assertEqual(result, False)