Пример #1
0
def test_count_flips_no_args():
    n = 1000
    heads = 0
    for i in range(n):
        ret = on_message({"text": u"!flip"}, None)
        if ret.startswith("heads"):
            heads += 1

    # 99.86% chance of being true
    assert 450 < heads < 550
Пример #2
0
def test_unicode():
    ret = on_message({"text": u"!flip Харито́н, Ки́р, Кири́лл"}, None)
    assert u"Кири́лл" in ret
    assert u"Ки́р" in ret
    assert u"Кири́лл" in ret
Пример #3
0
def test_some_args():
    ret = on_message({"text": u"!flip peter, paul, mary"}, None)
    assert "peter" in ret
    assert "paul" in ret
    assert "mary" in ret
Пример #4
0
def test_no_args():
    ret = on_message({"text": u"!flip"}, None)
    assert "heads" in ret
    assert "tails" in ret