本文整理汇总了Python中library.Library.report_inventory方法的典型用法代码示例。如果您正苦于以下问题:Python Library.report_inventory方法的具体用法?Python Library.report_inventory怎么用?Python Library.report_inventory使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类library.Library
的用法示例。
在下文中一共展示了Library.report_inventory方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_report_inventory
# 需要导入模块: from library import Library [as 别名]
# 或者: from library.Library import report_inventory [as 别名]
def test_report_inventory(self):
testlib = Library()
testlib.add_book(006.74, 'Teach Yourself HTML and CSS')
testlib.add_book(576.82, 'A New History of Life')
testlib.add_book(741.5942, 'The Thrilling Adventures of Lovelace and Babbage')
testlib.add_book(741.5942, 'The Thrilling Adventures of Lovelace and Babbage')
out = StringIO()
report = "The books in this library are:\n"
report += "6.74 - Teach Yourself HTML and CSS\n"
report += "576.82 - A New History of Life\n"
report += "741.5942 - The Thrilling Adventures of Lovelace and Babbage\n"
report += "741.5942 - The Thrilling Adventures of Lovelace and Babbage\n"
testlib.report_inventory(out)
assert out.getvalue() == report