Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def returns_lexica_for_reuse(self):
actions = Lexicon(
changelog=Changelog.NEEDS_RELEASE,
version=VersionFile.NEEDS_BUMP,
tag=Tag.NEEDS_CUTTING,
)
found_actions, found_state = _mock_status(self)
assert found_actions == actions
# Spot check state, don't need to check whole thing...
assert found_state.branch == self._branch
assert found_state.latest_version == Version("1.1.1")
assert found_state.tags == [Version(x) for x in self._tags]
def next_patch_of_bugfix_release(self):
versions = _latest_and_next_version(
Lexicon(
{
"release_type": Release.BUGFIX,
"latest_line_release": Version("1.2.2"),
"latest_overall_release": Version("1.4.1"), # realism!
}
)
)
assert versions == (Version("1.2.2"), Version("1.2.3"))
def next_patch_of_bugfix_release(self):
versions = _latest_and_next_version(
Lexicon(
{
"release_type": Release.BUGFIX,
"latest_line_release": Version("1.2.2"),
"latest_overall_release": Version("1.4.1"), # realism!
}
)
)
assert versions == (Version("1.2.2"), Version("1.2.3"))
def reprompts_on_bad_input(self, mock_input):
assert confirm("O rly?") is True
assert "I didn't understand you" in sys.stderr.getvalue()
def suffix_changes_when_assume_yes_False(self, mock_input):
confirm("Are you sure?", assume_yes=False)
assert mock_input.call_args[0][0] == "Are you sure? [y/N] "
def displays_question_with_yes_no_suffix(self, mock_input):
confirm("Are you sure?")
assert mock_input.call_args[0][0] == "Are you sure? [Y/n] "
def default_on_empty_response_is_True_by_default(self, mock_input):
assert confirm("Are you sure?") is True
def whitespace_is_trimmed(self, mock_input):
assert confirm("Are you sure?") is True
def default_on_empty_response_is_False_if_assume_yes_False(
self, mock_input
):
assert confirm("Are you sure?", assume_yes=False) is False
def returns_False_for_nolike_responses(self, mock_input):
for value in ("n", "N", "no", "NO", "nO", "No"):
mock_input.return_value = value
assert confirm("Meh") is False