Beispiel #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
    )
Beispiel #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"),
    ]
Beispiel #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
    )
Beispiel #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)
                         ]
Beispiel #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),
    ]
Beispiel #6
0
def test_quoted_sentence_neutral_pm(database):
    assert parse_message('"Foobar Baz"+-', database) == [
        RawKarma(name="Foobar Baz", op="+-", reason=None)
    ]
Beispiel #7
0
def test_quoted_negative(database):
    assert parse_message('"Foobar"--', database) == [
        RawKarma(name="Foobar", op="--", reason=None)
    ]
Beispiel #8
0
def test_blacklist_single_karma_quoted(database):
    assert parse_message('"c++"', database) is None
Beispiel #9
0
def test_blacklist_multiple_blocked(database):
    assert parse_message("c++ notepad++", database) is None
Beispiel #10
0
def test_blacklist_single_blocked_upper(database):
    assert parse_message("C++", database) is None
Beispiel #11
0
def test_blacklist_single_blocked_mixed(database):
    assert parse_message("NoTepAD++", database) is None
Beispiel #12
0
def test_blacklist_mixed_quoted_all_blocked(database):
    assert parse_message('"c++" notepad++', database) is None
Beispiel #13
0
def test_blacklist_blank(database):
    assert parse_message("", database) is None
Beispiel #14
0
def test_no_karma(database):
    assert parse_message("Hello, world!", database) is None
Beispiel #15
0
def test_empty(database):
    assert parse_message("", database) is None
Beispiel #16
0
def test_code_block_with_karma_op_after_and_external_reason(database):
    assert parse_message("```Foobar baz```++ because foo", database) is None
Beispiel #17
0
def test_code_block_external_reason(database):
    assert parse_message("```Foobar baz``` because foo", database) is None
Beispiel #18
0
def test_code_block_with_karma_op_after(database):
    assert parse_message("```Foobar baz```++", database) is None
Beispiel #19
0
def test_blacklist_mixed_quoted_allowed(database):
    assert parse_message('"c++" "notepad"++', database) == [
        RawKarma(name="notepad", op="++", reason=None)
    ]
Beispiel #20
0
def test_empty_with_code_block(database):
    assert parse_message("```FoobarBaz```", database) is None
Beispiel #21
0
def test_single_not_in_blacklist(database):
    assert parse_message("foo++", database) == [
        RawKarma(name="foo", op="++", reason=None)
    ]
Beispiel #22
0
def test_empty_with_inline_block(database):
    assert parse_message("`FoobarBaz`", database) is None
Beispiel #23
0
def test_blacklist_single_allowed_upper(database):
    assert parse_message('"C"++', database) == [
        RawKarma(name="C", op="++", reason=None)
    ]
Beispiel #24
0
def test_simple_positive(database):
    assert parse_message("Foobar++", database) == [
        RawKarma(name="Foobar", op="++", reason=None)
    ]
Beispiel #25
0
def test_blacklist_single_allowed_mixed(database):
    assert parse_message('"NoTepAD"++', database) == [
        RawKarma(name="NoTepAD", op="++", reason=None)
    ]
Beispiel #26
0
def test_simple_negative(database):
    assert parse_message("Foobar--", database) == [
        RawKarma(name="Foobar", op="--", reason=None)
    ]
Beispiel #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),
    ]
Beispiel #28
0
def test_simple_neutral_mp(database):
    assert parse_message("Foobar-+", database) == [
        RawKarma(name="Foobar", op="-+", reason=None)
    ]
Beispiel #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),
    ]
Beispiel #30
0
def test_quoted_positive(database):
    assert parse_message('"Foobar"++', database) == [
        RawKarma(name="Foobar", op="++", reason=None)
    ]