<commit_before>#!/usr/bin/env python2

import unittest
import os
import imp

yturl = imp.load_source("yturl", os.path.join(os.path.dirname(__file__), "yturl"))
y = yturl.YTURL("medium", "KxaCOHT0pmI")

class DatabaseUnitTests(unittest.TestCase):
    def testCorrectItagOrder(self):
        itagOrder = y.getDefaultItagQualityOrder()
        self.assertTrue(itagOrder.index("5") > itagOrder.index("46"))
        self.assertTrue(itagOrder.index("13") > itagOrder.index("17"))

    def testURLStripping(self):
        self.assertTrue(y.stripToVideoID("http://www.youtube.com/watch?feature=player_embedded&v=gEl6TXrkZnk") == "gEl6TXrkZnk")
        self.assertTrue(y.stripToVideoID("youtu.be/gEl6TXrkZnk#foo") == "gEl6TXrkZnk")

if __name__ == "__main__":
    unittest.main()<commit_msg>We also want to strip potential garbage.<commit_after>#!/usr/bin/env python2

import unittest
import os
import imp

yturl = imp.load_source("yturl", os.path.join(os.path.dirname(__file__), "yturl"))
y = yturl.YTURL("medium", "KxaCOHT0pmI")

class DatabaseUnitTests(unittest.TestCase):
    def testCorrectItagOrder(self):
        itagOrder = y.getDefaultItagQualityOrder()
        self.assertTrue(itagOrder.index("5") > itagOrder.index("46"))
        self.assertTrue(itagOrder.index("13") > itagOrder.index("17"))

    def testURLStripping(self):
        self.assertTrue(y.stripToVideoID("http://www.youtube.com/watch?feature=player_embedded&v=gEl6TXrkZnk") == "gEl6TXrkZnk")
        self.assertTrue(y.stripToVideoID("youtu.be/gEl6TXrkZnk#foo") == "gEl6TXrkZnk")
        self.assertTrue(y.stripToVideoID("youtu.be/gEl6TXrkZnkfoo") == "gEl6TXrkZnk")

if __name__ == "__main__":
    unittest.main()
{'fraction_non_alphanumeric': 0.15444245676803817, 'fraction_numerical': 0.016696481812760882, 'mean_word_length': 5.014336917562724, 'pattern_counts': {'":': 2, '<': 3, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, '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': '1282063', 'n_tokens_mistral': 644, 'n_tokens_neox': 623, 'n_words': 77}