<commit_before>from unittest import TestCase
from relative_placement import *

class Test(TestCase):
    def check_data(self, data):
        self.assertEquals([x[-1] for x in calculate_scores(data)], range(1, len(data)))

    def test_CDS_2011_int_jj_finals(self):
        data = [
            # couple ID, judge placements..., final placement
            [('<NAME>', '<NAME>'),       ( 2,  3,  1,  1,  3,  4,  9),  1],
            [('<NAME>', '<NAME>'),       ( 1,  1,  9,  5,  1,  3,  5),  2],
            [('<NAME>', '<NAME>'),     ( 3,  2,  6,  2,  7,  7,  1),  3],
            [('<NAME>', '<NAME>'),         ( 6,  4,  8,  4,  2,  6,  4),  4],
            [('<NAME>', '<NAME>'),       ( 5, 10,  4,  3,  8,  1,  7),  5],
            [('<NAME>', '<NAME>'),   ( 4,  9,  5,  6,  4,  2,  8),  6],
            [('<NAME>', '<NAME>'),    (10,  5,  7,  7,  9,  5,  3),  7],
            [('<NAME>', '<NAME>'),          ( 7,  6,  3, 10, 10, 10,  6),  8],
            [('<NAME>', '<NAME>'), ( 8,  7, 10,  8,  6,  9,  2),  9],
            [('<NAME>', '<NAME>'),       ( 9,  8,  2,  9,  5,  8, 10), 10],
        ]
        self.check_data(data)

    def test_CDS_2012_all_stars_jj_finals(self):
        data = [
            [('<NAME>', '<NAME>'),	    (2,	1,	1,	2,	3),	1],
            [('<NAME>', '<NAME>'),	        (4,	3,	6,	1,	1),	2],
            [('<NAME>', '<NAME>'),	(3,	2,	2,	6,	5),	3],
            [('<NAME>', '<NAME>'),	    (5,	4,	3,	3,	2),	4],
            [('<NAME>', '<NAME>'),	    (7,	6,	5,	5,	4),	5],
            [('<NAME>', '<NAME>'),	(6,	5,	7,	4,	6),	6],
            [('<NAME>', '<NAME>'),	    (1,	7,	4,	7,	7),	7],
        ]
        self.check_data(data)

    def test_example_from_WSDC_docs(self):
        data = [
            [('couple 1'), (1, 1, 3, 2, 3), 1],
            [('couple 2'), (6, 5, 4, 1, 2), 4],
            [('couple 3'), (2, 4, 1, 5, 5), 3],
            [('couple 4'), (4, 2, 5, 6, 6), 6],
            [('couple 5'), (5, 6, 2, 3, 4), 5],
            [('couple 6'), (3, 3, 6, 4, 1), 2],
        ]
        self.check_data(data)<commit_msg>fixed tests<commit_after>from unittest import TestCase, main as run_tests
from relative_placement import *

class Test(TestCase):
    def check_data(self, data):
        self.assertEquals([x[-1][-1] for x in calculate_scores(data)], range(1, len(data)+1))

    def test_CDS_2011_int_jj_finals(self):
        data = [
            # couple ID, judge placements..., final placement
            [('<NAME>', '<NAME>'),       ( 2,  3,  1,  1,  3,  4,  9),  1],
            [('<NAME>', '<NAME>'),       ( 1,  1,  9,  5,  1,  3,  5),  2],
            [('<NAME>', '<NAME>'),     ( 3,  2,  6,  2,  7,  7,  1),  3],
            [('<NAME>', '<NAME>'),         ( 6,  4,  8,  4,  2,  6,  4),  4],
            [('<NAME>', '<NAME>'),       ( 5, 10,  4,  3,  8,  1,  7),  5],
            [('<NAME>', '<NAME>'),   ( 4,  9,  5,  6,  4,  2,  8),  6],
            [('<NAME>', '<NAME>'),    (10,  5,  7,  7,  9,  5,  3),  7],
            [('<NAME>', '<NAME>'),          ( 7,  6,  3, 10, 10, 10,  6),  8],
            [('<NAME>', '<NAME>'), ( 8,  7, 10,  8,  6,  9,  2),  9],
            [('<NAME>', '<NAME>'),       ( 9,  8,  2,  9,  5,  8, 10), 10],
        ]
        self.check_data(data)

    def test_CDS_2012_all_stars_jj_finals(self):
        data = [
            [('<NAME>', '<NAME>'),	    (2,	1,	1,	2,	3),	1],
            [('<NAME>', '<NAME>'),	        (4,	3,	6,	1,	1),	2],
            [('<NAME>', '<NAME>'),	(3,	2,	2,	6,	5),	3],
            [('<NAME>', '<NAME>'),	    (5,	4,	3,	3,	2),	4],
            [('<NAME>', '<NAME>'),	    (7,	6,	5,	5,	4),	5],
            [('<NAME>', '<NAME>'),	(6,	5,	7,	4,	6),	6],
            [('<NAME>', '<NAME>'),	    (1,	7,	4,	7,	7),	7],
        ]
        self.check_data(data)

    def test_jose_de_la_mancha(self):
        data = [
            [('Couple A'),	    (4,	1,	1,	2,	1),	1],
            [('Couple B'),	    (2,	3,	5,	4,	4),	2],
            [('Couple C'),	    (1,	5,	4,	1,	5),	3],
            [('Couple D'),	    (5,	6,	3,	3,	8),	4],
            [('Couple E'),	    (7,	2,	2,	6,	7),	5],
            [('Couple F'),	    (6,	8,	8,	5,	2),	6],
            [('Couple G'),	    (8,	4,	6,	8,	6),	7],
            [('Couple H'),	    (3,	7,	7,	7,	3),	8],
        ]
        self.check_data(data)

    def test_example_from_WSDC_docs(self):
        data = [
            [('couple 1'), (1, 1, 3, 2, 3), 1],
            [('couple 2'), (6, 5, 4, 1, 2), 4],
            [('couple 3'), (2, 4, 1, 5, 5), 3],
            [('couple 4'), (4, 2, 5, 6, 6), 6],
            [('couple 5'), (5, 6, 2, 3, 4), 5],
            [('couple 6'), (3, 3, 6, 4, 1), 2],
        ]
        self.check_data(data)

if __name__ == '__main__':
    run_tests()
{'fraction_non_alphanumeric': 0.26187939484338374, 'fraction_numerical': 0.08821649264862562, 'mean_word_length': 1.563626433642818, 'pattern_counts': {'":': 0, '<': 71, '<?xml version=': 0, '>': 71, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 30, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2025674', 'n_tokens_mistral': 2173, 'n_tokens_neox': 2056, 'n_words': 557}