Exemple #1
0
class TestDirectoryStructure2MultiFile(unittest.TestCase):
    def setUp(self):
        self.churnhash = ChurnHash()
        for i in directory_structure2_multiple_files:
            self.churnhash.add_file_path(i['name'], i['value'])

    def test_churn_values_multi_file(self):
        self.assertEqual(self.churnhash.get_churn('a'), 12)
        self.assertEqual(self.churnhash.get_churn('a/b'), 12)
        self.assertEqual(self.churnhash.get_churn('a/b/c'), 12)
        self.assertEqual(self.churnhash.get_churn('a/b/c/d'), 6)
        self.assertEqual(self.churnhash.get_churn('a/b/c/e'), 2)
Exemple #2
0
class TestDirectoryStructure1Parsing(unittest.TestCase):
    def setUp(self):
        self.churnhash = ChurnHash()
        for i in directory_structure1:
            self.churnhash.add_file_path(i['name'], i['value'])

    def test_churn_values(self):
        self.assertEqual(self.churnhash.get_churn('a/b/c/d'), 4)
        self.assertEqual(self.churnhash.get_churn('a/b/c/e'), 2)
        self.assertEqual(self.churnhash.get_churn('a/b/c'), 8)
        self.assertEqual(self.churnhash.get_churn('a/b/f'), 5)
        self.assertEqual(self.churnhash.get_churn('a/b'), 13)
        self.assertEqual(self.churnhash.get_churn('a/g'), 2)
        self.assertEqual(self.churnhash.get_churn('a'), 15)
Exemple #3
0
 def setUp(self):
     self.churnhash = ChurnHash()
     for i in directory_structure2_multiple_files:
         self.churnhash.add_file_path(i['name'], i['value'])