Example #1
0
def test_expression_str_to_dict_raises_on_invalid_length_expression(invalid_length_expression_str):
    """
    Assert that :func:`~crython.expression._expression_str_to_dict` raises a :class:`~ValueError` when given
    an expression string that doesn't match the expected length.
    """
    with pytest.raises(ValueError):
        expression._expression_str_to_dict(invalid_length_expression_str)
Example #2
0
def test_expression_str_to_dict_raises_on_invalid_length_expression(invalid_length_expression_str):
    """
    Assert that :func:`~crython.expression._expression_str_to_dict` raises a :class:`~ValueError` when given
    an expression string that doesn't match the expected length.
    """
    with pytest.raises(ValueError):
        expression._expression_str_to_dict(invalid_length_expression_str)
Example #3
0
def test_expression_str_to_dict_returns_well_formed_dict_on_valid_str(valid_expression_str):
    """
    Assert that :func:`~crython.expression._expression_str_to_dict` returns a well-formed dictionary when
    given a valid expression string.
    """
    fields = expression._expression_str_to_dict(valid_expression_str)
    assert len(fields) == expression.FIELD_COUNT
Example #4
0
def test_expression_str_to_dict_returns_well_formed_dict_on_valid_str(valid_expression_str):
    """
    Assert that :func:`~crython.expression._expression_str_to_dict` returns a well-formed dictionary when
    given a valid expression string.
    """
    fields = expression._expression_str_to_dict(valid_expression_str)
    assert len(fields) == expression.FIELD_COUNT
Example #5
0
def test_expression_str_to_dict_returns_reboot_sentinel():
    """
    Assert that :func:`~crython.expression._expression_str_to_dict` returns
    :object:`~crython.expression.REBOOT_SENTINEL` when given :str:`~crython.expression.REBOOT_KEYWORD`.
    """
    assert expression._expression_str_to_dict(
        expression.REBOOT_KEYWORD) == expression.REBOOT_SENTINEL
Example #6
0
def test_expression_str_to_dict_returns_reboot_sentinel():
    """
    Assert that :func:`~crython.expression._expression_str_to_dict` returns
    :object:`~crython.expression.REBOOT_SENTINEL` when given :str:`~crython.expression.REBOOT_KEYWORD`.
    """
    assert expression._expression_str_to_dict(expression.REBOOT_KEYWORD) == expression.REBOOT_SENTINEL