def __str__(self): if self.is_reboot: return REBOOT_KEYWORD return ' '.join( compat.str(f) for f in (self.second, self.minute, self.hour, self.day, self.month, self.weekday, self.year))
def test_cron_expression_new_with_no_params_returns_default(): """ Assert that :meth:`~crython.expression.CronExpression.new` returns a :class:`~crython.expression.CronExpression` of the default expression value when not given any parameters. """ expr = expression.CronExpression.new() assert compat.str(expr) == expression.DEFAULT_VALUE
def test_cron_expression_new_handles_reserved_keywords(reserved_keywords): """ Assert that :meth:`~crython.expression.CronExpression.new` returns a :class:`~crython.expression.CronExpression` that maps to the correct space-delimited value for a given reserved keyword. """ keyword, value = reserved_keywords expr = expression.CronExpression.new(keyword) assert compat.str(expr) == expression.RESERVED_KEYWORDS[keyword]
def _phrase_to_numeral(phrase, phrases=PHRASES, regex=PHRASES_REGEX): """ Replace any full or abbreviated english dow/mon phrases (Jan, Monday, etc) from the field value with its respective integer value as a string. :param phrase: English word to convert to integer :param phrases: (Optional) Mapping of english word to integer value; Default: PHRASES :param regex: (Optional) Mapping of english word to integer value; Default: PHRASES_REGEX :return: String representation of integer value of the given english word """ def _repl(match): return compat.str(phrases[match.group(0).lower()]) return regex.sub(_repl, compat.str(phrase))
def __repr__(self): return '<{0}({1})>'.format(self.__class__.__name__, compat.str(self))
def __str__(self): return compat.str(self.value)
def _repl(match): return compat.str(phrases[match.group(0).lower()])
def __str__(self): if self.is_reboot: return REBOOT_KEYWORD return ' '.join(compat.str(f) for f in (self.second, self.minute, self.hour, self.day, self.month, self.weekday, self.year))
def second_field_valid_numeral_as_str(second_valid_numeral): """ Fixture that yields back a :class:`~crython.field.CronField` for the "second" field created with a valid numeral as a string. """ return field.second(compat.str(second_valid_numeral))