コード例 #1
0
def test_cli_rot13_ok():
    command, a, b, z = "ROT13", "A", "B", "Z"
    argv = ["ignore", command, a, b, z]
    m_a, m_b, m_z = cli.main(argv)
    assert m_a == "N"
    assert m_b == "O"
    assert m_z == "M"
コード例 #2
0
def test_cli_random_seed_ok():
    command, seed, a, b, z = "RNG", "42", "A", "B", "Z"
    argv = ["ignore", command, seed, a, b, z]
    m_a, m_b, m_z = cli.main(argv)
    assert m_a == "J"
    assert m_b == "W"
    assert m_z == "O"
コード例 #3
0
def test_cli_map_ok():
    a, b, z = "A", "B", "/"
    argv = ["ignore", a, b, z]
    m_a, m_b, m_z = cli.main(argv)
    assert m_a == "\n    A   \n   A A  \n  AAAAA \n A     A"
    assert m_b == "\n BBBB  \n B    B\n BBBB  \n B    B\n BBBB  "
    assert m_z == "\n  ???? \n ?    ?\n    ?  \n    ?  \n       \n    ?  "
コード例 #4
0
def test_cli_map_words_ok():
    a, sp, bee = "A", " ", "bee"
    argv = ["ignore", a, sp, bee]
    mapped = cli.main(argv)
    assert mapped == ('\n    A   \n   A A  \n  AAAAA \n A     A',
                      '\n       \n         \n          \n        ',
                      '\n  ???? \n ?    ?\n    ?  \n    ?  \n       \n    ?  ')
コード例 #5
0
def test_cli_random_really_words_ok():
    command, a, sp, bee = "RNG", "A", " ", "bee"
    argv = ["ignore", command, a, sp, bee]
    really_random = cli.main(argv)
    assert really_random[0] in string.ascii_letters
    assert really_random[1] == '?'
    assert all(c in string.ascii_letters for c in really_random[2:])
コード例 #6
0
def test_cli_random_really_ok():
    command, a, b, z = "RNG", "A", "B", "Z"
    argv = ["ignore", command, a, b, z]
    m_a, m_b, m_z = cli.main(argv)
    assert m_a in string.ascii_letters
    assert m_b in string.ascii_letters
    assert m_z in string.ascii_letters
    assert m_a != m_b
    assert m_b != m_z
コード例 #7
0
def test_cli_random_really_phrase_ok():
    command, phrase = "RNG", "A bee"
    argv = ["ignore", command, phrase]
    really_random = cli.main(argv)
    assert really_random[0] in string.ascii_letters
    assert really_random[1] == '?'
    assert all(c in string.ascii_letters for c in really_random[2:])
    for n, c in enumerate(really_random):
        for m, d in enumerate(really_random):
            if n != m:
                assert c != d or phrase[n] == phrase[
                    m], f"{c}, {d}, {n}, {m}, {phrase[n]}, {phrase[m]}"
コード例 #8
0
# -*- coding: utf-8 -*-
# pylint: disable=missing-docstring
import sys

from letters_from_letters.cli import main

if __name__ == "__main__":  # pragma: no cover
    sys.exit(main(sys.argv))
コード例 #9
0
def test_cli_random_words_ok():
    command, seed, a, sp, bee = "RNG", "42", "A", " ", "bee"
    argv = ["ignore", command, seed, a, sp, bee]
    shuffled = cli.main(argv)
    assert shuffled == ('J', '?', 'x', 'v', 'v')
コード例 #10
0
def test_cli_random_phrase_ok():
    command, seed, phrase = "RNG", "42", "A bee"
    argv = ["ignore", command, seed, phrase]
    shuffled = cli.main(argv)
    assert shuffled == ('J', '?', 'x', 'v', 'v')
コード例 #11
0
def test_cli_map_phrase_ok():
    phrase = "A bee"
    argv = ["ignore", phrase]
    mapped = cli.main(argv)
    assert mapped == (
        '\n  ???? \n ?    ?\n    ?  \n    ?  \n       \n    ?  ', )
コード例 #12
0
def test_cli_rot13_words_ok():
    command, a, sp, bee = "ROT13", "A", " ", "bee"
    argv = ["ignore", command, a, sp, bee]
    rotated = cli.main(argv)
    assert rotated == ('N', ' ', 'orr')
コード例 #13
0
def test_cli_rot13_phrase_ok():
    command, phrase = "ROT13", "A bee"
    argv = ["ignore", command, phrase]
    rotated = cli.main(argv)
    assert rotated == ('N orr', )
コード例 #14
0
def test_cli_rot13_spaces_ok():
    command, a, b, e, sp = "ROT13", "A", "b", "e", " "
    argv = ["ignore", command, a, sp, b, e, e]
    rotated = cli.main(argv)
    assert rotated == ('N', ' ', 'o', 'r', 'r')