コード例 #1
0
def test_sanitize_too_short_version_will_be_filled_with_zeros():
    """
    PyInstaller expects a version with exactly 4 places.
    If a shorter version is given, the lower parts will be filled with zeros.
    """
    metadata = MetaData(version="1.2")
    metadata.sanitize()
    assert metadata.version == "1.2.0.0"
コード例 #2
0
def test_sanitize_trailing_whitespace_gets_stripped(attribute, value):
    """
    Trailing whitespace in any parameter will be eliminated.
    """
    metadata = MetaData()
    setattr(metadata, attribute, value)
    metadata.sanitize()
    assert getattr(metadata, attribute) == value.strip()
コード例 #3
0
def test_sanitize_correct_values_are_not_altered(attribute):
    """
    Values which are already good to use remain untouched.
    """
    metadata = MetaData(**VALID_METADATA)
    metadata.sanitize()
    assert (
        getattr(metadata, attribute) == VALID_METADATA[attribute]
    )  # check if value is still the same as in the dictionary passed to the constructor