Пример #1
0
def test_string_starts_quoted_no_karma(database):
    assert (
        parse_message(
            '"Starting the sentence with a quote but there is no karma here', database
        )
        is None
    )
Пример #2
0
def test_complex_multiple_karma_with_reasons_and_quotes(database):
    assert parse_message(
        'Foobar++ because baz blat, "Hello world"-- for "foo, bar"', database
    ) == [
        RawKarma(name="Foobar", op="++", reason="baz blat"),
        RawKarma(name="Hello world", op="--", reason="foo, bar"),
    ]
Пример #3
0
def test_no_karma_complex_sentence(database):
    assert (
        parse_message(
            "Hello, world! This is a test input string with 30+ characters", database
        )
        is None
    )
Пример #4
0
def test_simple_multiple_karma_with_reasons_and_quotes(database):
    assert parse_message('Foobar++ because baz blat, "Hello world"--',
                         database) == [
                             RawKarma(name='Foobar',
                                      op='++',
                                      reason='baz blat'),
                             RawKarma(name='Hello world', op='--', reason=None)
                         ]
Пример #5
0
def test_complex_multiple_karma_no_reasons_quotes_no_comma_separation(database):
    assert parse_message(
        '"easy lover"++ "phil collins"++ "philip bailey"++', database
    ) == [
        RawKarma(name="easy lover", op="++", reason=None),
        RawKarma(name="phil collins", op="++", reason=None),
        RawKarma(name="philip bailey", op="++", reason=None),
    ]
Пример #6
0
def test_quoted_sentence_neutral_pm(database):
    assert parse_message('"Foobar Baz"+-', database) == [
        RawKarma(name="Foobar Baz", op="+-", reason=None)
    ]
Пример #7
0
def test_quoted_negative(database):
    assert parse_message('"Foobar"--', database) == [
        RawKarma(name="Foobar", op="--", reason=None)
    ]
Пример #8
0
def test_blacklist_single_karma_quoted(database):
    assert parse_message('"c++"', database) is None
Пример #9
0
def test_blacklist_multiple_blocked(database):
    assert parse_message("c++ notepad++", database) is None
Пример #10
0
def test_blacklist_single_blocked_upper(database):
    assert parse_message("C++", database) is None
Пример #11
0
def test_blacklist_single_blocked_mixed(database):
    assert parse_message("NoTepAD++", database) is None
Пример #12
0
def test_blacklist_mixed_quoted_all_blocked(database):
    assert parse_message('"c++" notepad++', database) is None
Пример #13
0
def test_blacklist_blank(database):
    assert parse_message("", database) is None
Пример #14
0
def test_no_karma(database):
    assert parse_message("Hello, world!", database) is None
Пример #15
0
def test_empty(database):
    assert parse_message("", database) is None
Пример #16
0
def test_code_block_with_karma_op_after_and_external_reason(database):
    assert parse_message("```Foobar baz```++ because foo", database) is None
Пример #17
0
def test_code_block_external_reason(database):
    assert parse_message("```Foobar baz``` because foo", database) is None
Пример #18
0
def test_code_block_with_karma_op_after(database):
    assert parse_message("```Foobar baz```++", database) is None
Пример #19
0
def test_blacklist_mixed_quoted_allowed(database):
    assert parse_message('"c++" "notepad"++', database) == [
        RawKarma(name="notepad", op="++", reason=None)
    ]
Пример #20
0
def test_empty_with_code_block(database):
    assert parse_message("```FoobarBaz```", database) is None
Пример #21
0
def test_single_not_in_blacklist(database):
    assert parse_message("foo++", database) == [
        RawKarma(name="foo", op="++", reason=None)
    ]
Пример #22
0
def test_empty_with_inline_block(database):
    assert parse_message("`FoobarBaz`", database) is None
Пример #23
0
def test_blacklist_single_allowed_upper(database):
    assert parse_message('"C"++', database) == [
        RawKarma(name="C", op="++", reason=None)
    ]
Пример #24
0
def test_simple_positive(database):
    assert parse_message("Foobar++", database) == [
        RawKarma(name="Foobar", op="++", reason=None)
    ]
Пример #25
0
def test_blacklist_single_allowed_mixed(database):
    assert parse_message('"NoTepAD"++', database) == [
        RawKarma(name="NoTepAD", op="++", reason=None)
    ]
Пример #26
0
def test_simple_negative(database):
    assert parse_message("Foobar--", database) == [
        RawKarma(name="Foobar", op="--", reason=None)
    ]
Пример #27
0
def test_multiple_not_in_blacklist(database):
    assert parse_message("foo++ bar++", database) == [
        RawKarma(name="foo", op="++", reason=None),
        RawKarma(name="bar", op="++", reason=None),
    ]
Пример #28
0
def test_simple_neutral_mp(database):
    assert parse_message("Foobar-+", database) == [
        RawKarma(name="Foobar", op="-+", reason=None)
    ]
Пример #29
0
def test_blacklist_multiple_allowed(database):
    assert parse_message('"c"++ "notepad"++', database) == [
        RawKarma(name="c", op="++", reason=None),
        RawKarma(name="notepad", op="++", reason=None),
    ]
Пример #30
0
def test_quoted_positive(database):
    assert parse_message('"Foobar"++', database) == [
        RawKarma(name="Foobar", op="++", reason=None)
    ]