-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest_build_tweet.py
49 lines (37 loc) · 2.67 KB
/
test_build_tweet.py
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
41
42
43
44
45
46
47
48
49
from tweet import build_tweet
def test_all_short():
assert build_tweet(
{'persons': [{'name': 'Demospeaker'}], 'room': 'Baumschule', 'title': 'This is my talk!'}
) == "Next up in Baumschule: »This is my talk!« by Demospeaker"
def test_multiple_speakers():
assert build_tweet(
{'persons': [{'name': 'Harry Potter'}, {'name': 'Ron Weasley'}],
'room': 'Baumschule', 'title': 'This is my talk!'}
) == "Next up in Baumschule: »This is my talk!« by Harry Potter, Ron Weasley"
def test_multiple_speakers_long_title():
assert build_tweet(
{'persons': [{'name': 'Harry Potter'}, {'name': 'Ron Weasley'}],
'room': 'Baumschule', 'title': 'This is my talk, and I will talk as long as I want, until it is over, '
'really! I will do this all tweet long!'}
) == "Next up in Baumschule: »This is my talk, and I will talk as long as I want, until it is over, really! I will …« by Harry Potter, Ron Weasley"
def test_multiple_speakers_too_long():
assert build_tweet(
{'persons': [{'name': 'Karl-Theodor Maria Nikolaus Johann Jacob Philipp Franz Joseph Sylvester Buhl-Freiherr von und zu Guttenberg'}, {'name': 'Ron Weasley'}],
'room': 'Baumschule', 'title': 'This is my talk, and I will talk as long as I want, until it is over, '
'really! I will do this all tweet long!'}
) == "Next up in Baumschule: »This is my talk, and I will talk as long as I want, until it is over, " \
"really! I will do this all tweet long!«"
def test_multiple_speakers_too_long_and_title_too_long():
assert build_tweet(
{'persons': [{'name': 'Karl-Theodor Maria Nikolaus Johann Jacob Philipp Franz Joseph Sylvester Buhl-Freiherr von und zu Guttenberg'}, {'name': 'Ron Weasley'}],
'room': 'Baumschule', 'title': 'This is my talk, and I will talk as long as I want, until it is over, '
'really! I will do this all tweet long if I want to, because I can!'}
) == "Next up in Baumschule: »This is my talk, and I will talk as long as I want, until it is over, " \
"really! I will do this all tweet long if I w…«"
def test_no_speakers_and_title_too_long():
assert build_tweet(
{'persons': [],
'room': 'Baumschule', 'title': 'This is my talk, and I will talk as long as I want, until it is over, '
'really! I will do this all tweet long if I want to, because I can!'}
) == "Next up in Baumschule: »This is my talk, and I will talk as long as I want, until it is over, " \
"really! I will do this all tweet long if I w…«"