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 )
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"), ]
def test_no_karma_complex_sentence(database): assert ( parse_message( "Hello, world! This is a test input string with 30+ characters", database ) is None )
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) ]
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), ]
def test_quoted_sentence_neutral_pm(database): assert parse_message('"Foobar Baz"+-', database) == [ RawKarma(name="Foobar Baz", op="+-", reason=None) ]
def test_quoted_negative(database): assert parse_message('"Foobar"--', database) == [ RawKarma(name="Foobar", op="--", reason=None) ]
def test_blacklist_single_karma_quoted(database): assert parse_message('"c++"', database) is None
def test_blacklist_multiple_blocked(database): assert parse_message("c++ notepad++", database) is None
def test_blacklist_single_blocked_upper(database): assert parse_message("C++", database) is None
def test_blacklist_single_blocked_mixed(database): assert parse_message("NoTepAD++", database) is None
def test_blacklist_mixed_quoted_all_blocked(database): assert parse_message('"c++" notepad++', database) is None
def test_blacklist_blank(database): assert parse_message("", database) is None
def test_no_karma(database): assert parse_message("Hello, world!", database) is None
def test_empty(database): assert parse_message("", database) is None
def test_code_block_with_karma_op_after_and_external_reason(database): assert parse_message("```Foobar baz```++ because foo", database) is None
def test_code_block_external_reason(database): assert parse_message("```Foobar baz``` because foo", database) is None
def test_code_block_with_karma_op_after(database): assert parse_message("```Foobar baz```++", database) is None
def test_blacklist_mixed_quoted_allowed(database): assert parse_message('"c++" "notepad"++', database) == [ RawKarma(name="notepad", op="++", reason=None) ]
def test_empty_with_code_block(database): assert parse_message("```FoobarBaz```", database) is None
def test_single_not_in_blacklist(database): assert parse_message("foo++", database) == [ RawKarma(name="foo", op="++", reason=None) ]
def test_empty_with_inline_block(database): assert parse_message("`FoobarBaz`", database) is None
def test_blacklist_single_allowed_upper(database): assert parse_message('"C"++', database) == [ RawKarma(name="C", op="++", reason=None) ]
def test_simple_positive(database): assert parse_message("Foobar++", database) == [ RawKarma(name="Foobar", op="++", reason=None) ]
def test_blacklist_single_allowed_mixed(database): assert parse_message('"NoTepAD"++', database) == [ RawKarma(name="NoTepAD", op="++", reason=None) ]
def test_simple_negative(database): assert parse_message("Foobar--", database) == [ RawKarma(name="Foobar", op="--", reason=None) ]
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), ]
def test_simple_neutral_mp(database): assert parse_message("Foobar-+", database) == [ RawKarma(name="Foobar", op="-+", reason=None) ]
def test_blacklist_multiple_allowed(database): assert parse_message('"c"++ "notepad"++', database) == [ RawKarma(name="c", op="++", reason=None), RawKarma(name="notepad", op="++", reason=None), ]
def test_quoted_positive(database): assert parse_message('"Foobar"++', database) == [ RawKarma(name="Foobar", op="++", reason=None) ]