-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathtests.py
More file actions
40 lines (31 loc) · 1.36 KB
/
tests.py
File metadata and controls
40 lines (31 loc) · 1.36 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
from unittest import TestCase
from easypoll import PollException
from easypoll import Poll
class Tests(TestCase):
def test_poll(self):
p1 = Poll("q1", ["one", "two", "three"])
p2 = Poll.from_str('/poll "q1" "one" "two" "three"')
self.assertEqual(p1, p2)
p1 = Poll("Yay", [])
p2 = Poll.from_str('/poll "Yay"')
self.assertEqual(p1, p2)
p1 = Poll(" ", [])
p2 = Poll.from_str('/poll " "')
self.assertEqual(p1, p2)
p1 = Poll("", [])
p2 = Poll.from_str('/poll ""')
self.assertEqual(p1, p2)
p1 = Poll("no", ["fkin", "commas", "!"])
p2 = Poll.from_str('/poll "no", "fkin", "commas", "!"')
self.assertEqual(p1, p2)
self.assertRaises(PollException, Poll.from_str, "/poll")
self.assertRaises(PollException, Poll.from_str, "")
self.assertRaises(PollException, Poll.from_str, '/poll " " "')
self.assertRaises(
PollException, Poll.from_str, '/poll one two three?" "four five" "six"'
)
def test_get_regional_indicator_symbol(self):
self.assertEqual("🇦", Poll.get_regional_indicator_symbol(0))
self.assertEqual("🇿", Poll.get_regional_indicator_symbol(25))
self.assertEqual("", Poll.get_regional_indicator_symbol(26))
self.assertEqual("", Poll.get_regional_indicator_symbol(-1))