<commit_before>from nose.tools import assert_true

def test_find_sampling_selector():
    from zope.interface import implementedBy
    import cc.license

    sampling_selector = cc.license.get_selector('recombo')
    return sampling_selector

def test_find_standard_selector():
    from zope.interface import implementedBy
    import cc.license

    standard_selector = cc.license.get_selector('standard')
    return standard_selector

def test_bysa_10_up_the_supersede_chain():
    selector = test_find_standard_selector()
    lic = selector.by_code('by-sa', version='1.0')
    assert lic.superseded # 1.0 we know is old

    highest_lic = lic.current_version
    assert lic.version != highest_lic.version # We know 1.0 is not the latest

    highest_by_crawl = lic # to start with
    while highest_by_crawl.superseded:
        started_with = highest_by_crawl
        print 'Started with', started_with.version
        highest_by_crawl = highest_by_crawl.superseded
        print 'Moved on to', highest_by_crawl.version

        # Check that every bump upwards in the chain is really the same license
        assert started_with.license_code == highest_by_crawl.license_code

    # Finally, check for equality
    assert highest_by_crawl == highest_lic
    assert highest_by_crawl.current_version == highest_by_crawl

    # FIXME: Later, check that they "is" each other?
    # We don't need that necessarily.

def test_all_bysa_10_the_same():
    selector = test_find_standard_selector()
    lic1 = selector.by_code('by-sa')
    lic2 = selector.by_code('by-sa')
    assert (lic1 == lic2)<commit_msg>Make sure when we climb to the top, we are at least as new as 3.0<commit_after>from nose.tools import assert_true

def test_find_sampling_selector():
    from zope.interface import implementedBy
    import cc.license

    sampling_selector = cc.license.get_selector('recombo')
    return sampling_selector

def test_find_standard_selector():
    from zope.interface import implementedBy
    import cc.license

    standard_selector = cc.license.get_selector('standard')
    return standard_selector

def test_bysa_10_up_the_supersede_chain():
    selector = test_find_standard_selector()
    lic = selector.by_code('by-sa', version='1.0')
    assert lic.superseded # 1.0 we know is old

    highest_lic = lic.current_version
    assert lic.version != highest_lic.version # We know 1.0 is not the latest

    highest_by_crawl = lic # to start with
    while highest_by_crawl.superseded:
        started_with = highest_by_crawl
        print 'Started with', started_with.version
        highest_by_crawl = highest_by_crawl.superseded
        print 'Moved on to', highest_by_crawl.version

        # Check that every bump upwards in the chain is really the same license
        assert started_with.license_code == highest_by_crawl.license_code

    assert highest_by_crawl.version >= "3.0"

    # Finally, check for equality
    assert highest_by_crawl == highest_lic
    assert highest_by_crawl.current_version == highest_by_crawl

    # FIXME: Later, check that they "is" each other?
    # We don't need that necessarily.

def test_all_bysa_10_the_same():
    selector = test_find_standard_selector()
    lic1 = selector.by_code('by-sa')
    lic2 = selector.by_code('by-sa')
    assert (lic1 == lic2)
{'fraction_non_alphanumeric': 0.07333333333333333, 'fraction_numerical': 0.009696969696969697, 'mean_word_length': 3.7840579710144926, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 4, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1058783', 'n_tokens_mistral': 1053, 'n_tokens_neox': 992, 'n_words': 265}