Пример #1
0
 def test_format_result_project_noscript(self):
     a_result = "No python script was found."
     l_result = []
     pos_is = "project"
     i_align_max = 0
     result = pl.format_result(l_result, pos_is, i_align_max, "", None,
                               False, False, False, True)
     self.assertEqual(result, a_result)
Пример #2
0
 def test_format_result_project_exem(self):
     a_result = "Only empty python scripts were found."
     l_result = [[0]]
     pos_is = "project"
     i_align_max = 0
     result = pl.format_result(l_result, pos_is, i_align_max, "", None,
                               False, False, False, True)
     self.assertEqual(result, a_result)
Пример #3
0
 def test_format_result_project(self):
     a_result = "Your project contains 53 lines."
     l_result = [[13], [26], [14]]
     pos_is = "project"
     i_align_max = 0
     result = pl.format_result(l_result, pos_is, i_align_max, "", None,
                               False, False, False, False)
     self.assertEqual(result, a_result)
Пример #4
0
 def test_format_result_script(self):
     a_result = "Your script contains 13 lines."
     l_result = [[13]]
     pos_is = "script"
     i_align_max = 0
     result = pl.format_result(l_result, pos_is, i_align_max, "", None,
                               False, False, False, False)
     self.assertEqual(result, a_result)
Пример #5
0
 def test_format_result_script_byfile(self):
     a_result = "File              Nb line   \n----              -------  "\
                " \ntest_1.py         13        "
     l_result = [['test_1.py', 13]]
     pos_is = "script"
     i_align_max = 9
     result = pl.format_result(l_result, pos_is, i_align_max, "", None,
                               False, False, True, False)
     self.assertEqual(result, a_result)
Пример #6
0
 def test_format_result_project_byfile(self):
     a_result = "File              Nb line   \n----              -------  "\
                " \ntest_1.py         13        \ntest_2.pyw        14    "\
                "    \ntest_3.py         26        "\
                "\n-------------------------\nTOTAL (3 files)   53        "
     l_result = [['test_1.py', 13], ['test_3.py', 26], ['test_2.pyw', 14]]
     pos_is = "project"
     i_align_max = 10
     result = pl.format_result(l_result, pos_is, i_align_max, "", None,
                               False, False, True, False)
     self.assertEqual(result, a_result)
Пример #7
0
 def test_format_result_script_detail(self):
     a_result = "Nb line   Class   Decorator   Function   Doctring   "\
                "Comment   Blank line\n-------   -----   ---------   "\
                "--------   --------   -------   ----------\n13        0  "\
                "     0           1          2          2         6"
     l_result = [[13, 0, 0, 1, 2, 2, 6]]
     pos_is = "script"
     i_align_max = 0
     result = pl.format_result(l_result, pos_is, i_align_max, "", None,
                               False, True, False, False)
     self.assertEqual(result, a_result)
Пример #8
0
 def test_format_result_project_detail(self):
     a_result = "Nb line   Class   Decorator   Function   Doctring   "\
                "Comment   Blank line\n-------   -----   ---------   "\
                "--------   --------   -------   ----------\n53        0  "\
                "     1           5          6          6         20"
     l_result = [[13, 0, 0, 1, 2, 2, 6], [26, 0, 1, 3, 2, 2, 8],
                 [14, 0, 0, 1, 2, 2, 6]]
     pos_is = "project"
     i_align_max = 0
     result = pl.format_result(l_result, pos_is, i_align_max, "", None,
                               False, True, False, False)
     self.assertEqual(result, a_result)
Пример #9
0
 def test_format_result_script_detail_byfile(self):
     a_result = "File              Nb line   Class   Decorator   Function "\
                "  Doctring   Comment   Blank line\n----              "\
                "-------   -----   ---------   --------   --------   "\
                "-------   ----------\ntest_1.py         13        0      "\
                " 0           1          2          2         6"
     l_result = [['test_1.py', 13, 0, 0, 1, 2, 2, 6]]
     pos_is = "script"
     i_align_max = 9
     result = pl.format_result(l_result, pos_is, i_align_max, "", None,
                               False, True, True, False)
     self.assertEqual(result, a_result)
Пример #10
0
 def test_format_result_project_detail_byfile(self):
     a_result = "File              Nb line   Class   Decorator   Function "\
                "  Doctring   Comment   Blank line\n----              "\
                "-------   -----   ---------   --------   --------   "\
                "-------   ----------\ntest_1.py         13        0      "\
                " 0           1          2          2         "\
                "6\ntest_2.pyw        14        0       0           1     "\
                "     2          2         6\ntest_3.py         26        "\
                "0       1           3          2          2         "\
                "8\n------------------------------------------------------"\
                "------------------------------------\nTOTAL (3 files)   "\
                "53        0       1           5          6          6    "\
                "     20"
     l_result = [['test_1.py', 13, 0, 0, 1, 2, 2, 6],
                 ['test_3.py', 26, 0, 1, 3, 2, 2, 8],
                 ['test_2.pyw', 14, 0, 0, 1, 2, 2, 6]]
     pos_is = "project"
     i_align_max = 10
     result = pl.format_result(l_result, pos_is, i_align_max, "", None,
                               False, True, True, False)
     self.assertEqual(result, a_result)
Пример #11
0
 def test_format_result_project_detail_byfile_sort(self):
     a_result = "File                  Nb line   Class   Decorator   "\
                "Function   Doctring   Comment   Blank line\n----         "\
                "         -------   -----   ---------   --------   "\
                "--------   -------   ----------\ntest_3.py             "\
                "26        0       1           3          2          2    "\
                "     8\ntest_recursion_1.py   15        0       0        "\
                "   1          2          2         6\ntest_2.pyw         "\
                "   14        0       0           1          2          2 "\
                "        6\ntest_1.py             13        0       0     "\
                "      1          2          2         "\
                "6\n------------------------------------------------------"\
                "----------------------------------------\nTOTAL (4 files)"\
                "       68        0       1           6          8        "\
                "  8         26"
     l_result = [['test_1.py', 13, 0, 0, 1, 2, 2, 6],
                 ['test_3.py', 26, 0, 1, 3, 2, 2, 8],
                 ['test_recursion_1.py', 15, 0, 0, 1, 2, 2, 6],
                 ['test_2.pyw', 14, 0, 0, 1, 2, 2, 6]]
     pos_is = "project"
     i_align_max = 19
     result = pl.format_result(l_result, pos_is, i_align_max, "_nb", None,
                               False, True, True, False)
     self.assertEqual(result, a_result)