def test_parse_1(self): parser = BooksParser("Books.xml") parser.parse() self.assertNotEqual(0, len(parser._books_list))
#!/usr/bin/env python # -*- coding: utf-8 -*- """ @author: Paweł Pęksa """ from src.BooksParser import BooksParser import logging if __name__ == '__main__': logging.info('Lab 01 | Problem 2') parser = BooksParser("Books.xml") parser.parse() parser.print_books()
def testIfXMLIncorrect(self): parser = BooksParser("invalidBooks.xml") self.assertRaises(ET.ParseError)
def test_init_2(self): with self.assertRaises(SystemExit): book_parser = BooksParser("")
def test_init_1(self): with self.assertRaises(SystemExit): book_parser = BooksParser("no_exist")