Exemple #1
0
def to_db(value):
    """Flatten the given value (string, list of plurals or multistring) into
    the database string representation.
    """
    if value is None:
        return None

    return unparse_multistring(value)
Exemple #2
0
def to_db(value):
    """Flatten the given value (string, list of plurals or multistring) into
    the database string representation.
    """
    if value is None:
        return None

    return unparse_multistring(value)
Exemple #3
0
def test_unparse_multistring(values_list, expected_ms, has_plural_placeholder):
    if has_plural_placeholder:
        values_list.plural = True
    unparsed_ms = unparse_multistring(values_list)
    assert unparsed_ms == expected_ms
Exemple #4
0
def test_unparse_multistring_invalid(invalid_value):
    """Tests unparsing does nothing for unsupported values."""
    assert unparse_multistring(invalid_value) == invalid_value
Exemple #5
0
def test_unparse_multistring(values_list, expected_ms, has_plural_placeholder):
    if has_plural_placeholder:
        values_list.plural = True
    unparsed_ms = unparse_multistring(values_list)
    assert unparsed_ms == expected_ms
Exemple #6
0
def test_unparse_multistring_invalid(invalid_value):
    """Tests unparsing does nothing for unsupported values."""
    assert unparse_multistring(invalid_value) == invalid_value