def test_choose_between_same_versions(d1, d2, prefer_final, expected):
    """ Tests choosing between two distributions with the same
        version in the installer.
    """
    installer = Installer()
    if prefer_final:
        comparitor = _final_version
    else:
        comparitor = installer.is_dev_version

    # Ordering is important here - it should choose the first one
    choice = installer.choose_between(d1, d2, comparitor)
    assert repr(choice) == expected
def test_choose_between_same_versions(d1, d2, prefer_final, expected):
    """ Tests choosing between two distributions with the same
        version in the installer.
    """
    installer = Installer()
    if prefer_final:
        comparitor = _final_version
    else:
        comparitor = installer.is_dev_version

    # Ordering is important here - it should choose the first one
    choice = installer.choose_between(d1, d2, comparitor)
    assert repr(choice) == expected
def test_choose_between_different_versions(d1, d2, prefer_final, expected):
    """ Tests choosing between two different versions of a
        package in the installer
    """
    installer = Installer()
    if prefer_final:
        comparitor = _final_version
    else:
        comparitor = installer.is_dev_version

    choice = installer.choose_between(d1, d2, comparitor)
    assert repr(choice) == expected

    # Ordering shouldn't matter
    choice = installer.choose_between(d2, d1, comparitor)
    assert repr(choice) == expected
def test_choose_between_different_versions(d1, d2, prefer_final, expected):
    """ Tests choosing between two different versions of a
        package in the installer
    """
    installer = Installer()
    if prefer_final:
        comparitor = _final_version
    else:
        comparitor = installer.is_dev_version

    choice = installer.choose_between(d1, d2, comparitor)
    assert repr(choice) == expected

    # Ordering shouldn't matter
    choice = installer.choose_between(d2, d1, comparitor)
    assert repr(choice) == expected