Esempio n. 1
0
 def test_two_modules_combination2(self):
     changed_py_files = {'b.py': get_modules([103, 104])}
     assert is_dependent({'a.py': [101, 102]}, changed_py_files) == False
     assert is_dependent({
         'a.py': [101],
         'b.py': [107]
     }, changed_py_files) == True
Esempio n. 2
0
    def test_classes_depggraph(self):
        module1 = Module(CodeSample("""\
            class TestA(object):
                def test_one(self):
                    print("1")

                def test_two(self):
                    print("2")
        """).source_code)
        bs1 = module1.blocks

        module2 = Module(CodeSample("""\
            class TestA(object):
                def test_one(self):
                    print("1")

                def test_twob(self):
                    print("2")
        """).source_code)
        bs2 = module2.blocks

        assert bs1[0] == bs2[0]
        assert bs1[1] != bs2[1]
        assert bs1[2] != bs2[2]

        assert len(module1.blocks) == len(module2.blocks) == 3
        assert (bs1[1].start,
                bs1[1].end,
                bs1[1].checksum) == (bs2[1].start,
                                     bs2[1].end,
                                     bs2[1].checksum)
        assert (bs1[1].name) != (bs2[1].name)

        assert is_dependent({'test_s.py': [bs1[0].checksum, bs1[2].checksum]},
                            {'test_s.py': [b.checksum for b in bs2]}) == True
        assert is_dependent({'test_s.py': [bs1[1].checksum, bs1[2].checksum]},
                            {'test_s.py': [b.checksum for b in bs2]}) == True
Esempio n. 3
0
    def test_classes_depggraph(self):
        module1 = Module(
            CodeSample("""\
            class TestA(object):
                def test_one(self):
                    print("1")

                def test_two(self):
                    print("2")
        """).source_code)
        bs1 = module1.blocks

        module2 = Module(
            CodeSample("""\
            class TestA(object):
                def test_one(self):
                    print("1")

                def test_twob(self):
                    print("2")
        """).source_code)
        bs2 = module2.blocks

        assert bs1[0] == bs2[0]
        assert bs1[1] != bs2[1]
        assert bs1[2] != bs2[2]

        assert len(module1.blocks) == len(module2.blocks) == 3
        assert (bs1[1].start, bs1[1].end,
                bs1[1].checksum) == (bs2[1].start, bs2[1].end, bs2[1].checksum)
        assert (bs1[1].name) != (bs2[1].name)

        assert is_dependent({'test_s.py': [bs1[0].checksum, bs1[2].checksum]},
                            {'test_s.py': [b.checksum for b in bs2]}) == True
        assert is_dependent({'test_s.py': [bs1[1].checksum, bs1[2].checksum]},
                            {'test_s.py': [b.checksum for b in bs2]}) == True
Esempio n. 4
0
 def test_two_modules_combination3(self):
     changed_py_files = {'b.py': get_modules([103, 104])}
     assert is_dependent('test_1', changed_py_files) == False
     assert is_dependent('test_both', changed_py_files) == False
Esempio n. 5
0
 def test_two_modules_combination2(self):
     changed_py_files = {'b.py': get_modules([103, 104])}
     assert is_dependent({'a.py': [101, 102]}, changed_py_files) == False
     assert is_dependent({'a.py': [101], 'b.py': [107]}, changed_py_files) == True
Esempio n. 6
0
 def test_dep_graph_two_modules(self):
     changed_py_files = {'b.py': get_modules([])}
     assert is_dependent({'a.py': [101, 102]}, changed_py_files) == False
     assert is_dependent({'b.py': [103, 104]}, changed_py_files) == True
Esempio n. 7
0
 def test_dep_graph4(self):
     assert is_dependent({'a.py': [101, 102]}, {'a.py': get_modules([101, 103])}) == True
Esempio n. 8
0
 def test_dep_graph_new(self):
     assert is_dependent({'a.py': [101, 102]}, {'new.py': get_modules([101, 102, 3]),
                                                'a.py': get_modules([101, 102, 3])}) == False
Esempio n. 9
0
 def test_dep_graph1(self):
     assert is_dependent({'a.py': [101, 102]}, {'a.py': [101, 102, 3]}) == False
Esempio n. 10
0
 def test_two_modules_combination3(self):
     changed_py_files = {'b.py': get_modules([103, 104])}
     assert is_dependent('test_1', changed_py_files) == False
     assert is_dependent('test_both', changed_py_files) == False
Esempio n. 11
0
 def test_dep_graph_two_modules(self):
     changed_py_files = {'b.py': get_modules([])}
     assert is_dependent({'a.py': [101, 102]}, changed_py_files) == False
     assert is_dependent({'b.py': [103, 104]}, changed_py_files) == True
Esempio n. 12
0
 def test_dep_graph4(self):
     assert is_dependent({'a.py': [101, 102]},
                         {'a.py': get_modules([101, 103])}) == True
Esempio n. 13
0
 def test_dep_graph_new(self):
     assert is_dependent({'a.py': [101, 102]}, {
         'new.py': get_modules([101, 102, 3]),
         'a.py': get_modules([101, 102, 3])
     }) == False
Esempio n. 14
0
 def test_dep_graph1(self):
     assert is_dependent({'a.py': [101, 102]},
                         {'a.py': [101, 102, 3]}) == False