示例#1
0
 def test_parse_1(self):
     parser = BooksParser("Books.xml")
     parser.parse()
     self.assertNotEqual(0, len(parser._books_list))
示例#2
0
文件: main.py 项目: pawelpeksa/Lab_1
#!/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()



示例#3
0
 def testIfXMLIncorrect(self):
     parser = BooksParser("invalidBooks.xml")
     self.assertRaises(ET.ParseError)
示例#4
0
 def test_parse_1(self):
     parser = BooksParser("Books.xml")
     parser.parse()
     self.assertNotEqual(0, len(parser._books_list))
示例#5
0
 def test_init_2(self):
     with self.assertRaises(SystemExit):
         book_parser = BooksParser("")
示例#6
0
 def test_init_1(self):
     with self.assertRaises(SystemExit):
         book_parser = BooksParser("no_exist")