summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOlivier Gayot <olivier.gayot@sigexec.com>2020-05-12 20:55:14 +0200
committerOlivier Gayot <olivier.gayot@sigexec.com>2020-05-12 21:42:40 +0200
commit310f104734c72cad3b73901d5bf0ee7cef067e3a (patch)
treec07c8a494aa3e823b79bc2f7cf90113ff056a1ec
parent620c674f2b7e734fc9cd010daac2a7417d839f87 (diff)
Add unit tests for swifstory.cards
Signed-off-by: Olivier Gayot <olivier.gayot@sigexec.com>
-rw-r--r--tests/test_cards.py27
1 files changed, 27 insertions, 0 deletions
diff --git a/tests/test_cards.py b/tests/test_cards.py
new file mode 100644
index 0000000..019d512
--- /dev/null
+++ b/tests/test_cards.py
@@ -0,0 +1,27 @@
+import unittest
+
+from swiftstory.Cards import Cards
+
+
+class TestCards(unittest.TestCase):
+ def test_get_cards_fr(self):
+ self.assertTrue(Cards.get_white_cards("fr"))
+ self.assertTrue(Cards.get_black_cards("fr"))
+
+ def test_get_cards_en(self):
+ self.assertTrue(Cards.get_white_cards("en"))
+ self.assertTrue(Cards.get_black_cards("en"))
+
+ def test_get_cards_unknown_language(self):
+ try:
+ Cards.get_white_cards("zz")
+ except FileNotFoundError:
+ pass
+ else:
+ self.fail("Found zz white cards.")
+ try:
+ Cards.get_black_cards("zz")
+ except FileNotFoundError:
+ pass
+ else:
+ self.fail("Found zz black cards.")