-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest.py
More file actions
22 lines (15 loc) · 843 Bytes
/
test.py
File metadata and controls
22 lines (15 loc) · 843 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
import unittest
from backend import Backend
class TestBackend(unittest.TestCase):
def test_filter(self):
backend = Backend(True)
backend.add_book(["TestTitle", "TestAuthor", "TestGenre", 1000])
backend.add_book(["Neville's Journal", "Neville", "Journal", 10])
backend.add_book(["Blabook", "Tom", "Random", 504])
backend.add_book(["Lalabok", "Tim", "Special", 6000])
self.assertEqual(backend.filter_for("Title", "TestTitle").values.tolist()[0][0], "TestTitle")
self.assertEqual(backend.filter_for("Author", "Tom").values.tolist()[0][0], "Blabook")
self.assertEqual(len(backend.filter_for("Genre", "").values.tolist()),0)
self.assertEqual(backend.filter_for("Pages", 10).values.tolist()[0][0], "Neville's Journal")
if __name__ == '__main__':
unittest.main()