Beispiel #1
0
 def test_add_total_score(self):
     ep.ExcelOutput.write_excel(self.excel,1)
     ep.ExcelOutput.add_total_score(self.excel)
     ep.ExcelOutput.close_workbook(self.excel)
     array = fi.readfile(self.file_name)
     array = fi.transpose(array)
     self.assertTrue(array[1][5] == 4)
Beispiel #2
0
 def test_add_correlation(self):
     ep.ExcelOutput.write_excel(self.excel,0)
     ep.ExcelOutput.add_total_score(self.excel)
     ep.ExcelOutput.add_correlation(self.excel, [5,5,5,5], 'row')
     ep.ExcelOutput.close_workbook(self.excel)
     array = fi.readfile(self.file_name)
     array = fi.transpose(array)
     self.assertTrue(array[1][6] == 5)
 def test_transpose_matrix(self):
     self.assertTrue(
         ad.transpose_matrix(self.data_shoudlbe) == fi.transpose(
             self.data_shoudlbe))
    def setUp(self) -> None:
        # The path should be configured as the full path of the test data file. TODO: I don't really understand why the relative path not working.
        path = "/Users/Apple/Documents/Google-Sync/SWEN90014 Master Project/Project/swen90014-2019-rv-quoll" \
               "/testdata/SampleAssessmentResult.xlsx"
        self.data = fi.readfile(path)
        self.data = fi.transpose(self.data)
        fi.sort_2d_array_mark(self.data)
        # After reading from excel_importing module, the data read transformed as original_data.
        # Here only performing unit test for guttman-analysis module and aussmes that the data imported are correct.
        self.original_data = [[
            '', 'etc…', 'Recognises steps in the teaching and learning cycle.',
            'Defines 21st century competencies', 'etc…', 'etc…', 'etc…',
            'etc…', 'Distinguishes between competence and content.',
            'Identifies levels of competence.', 'etc…',
            'Interprets learning progressions describing increasing competence.',
            'Describes methods for assessment of competence.',
            'Connects teaching and learning cycle to classroom practice.',
            'Distinguishes between evidence and inference.',
            'Lists methods of evidence collection.', 'etc…',
            'Explains plan for meeting student needs.',
            'Uses teaching and learning cycle to plan instruction.', 'etc…',
            'etc…', 'etc…', 'etc…'
        ],
                              [
                                  'student_id', '2.1.1', '1.3.1', '1.1.1',
                                  '3.1.1', '2.1.2', '3.1.2', '3.1.3', '1.2.1',
                                  '1.1.2', '4.1.1', '1.1.3', '1.2.2', '1.3.2',
                                  '1.4.1', '1.4.2', '4.1.2', '1.2.3', '1.3.3',
                                  '2.1.3', '2.1.4', '3.1.4', '4.1.3'
                              ],
                              [
                                  '664', 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 0, 1,
                                  1, 1, 1, 0, 0, 0, 0, 0, 0
                              ],
                              [
                                  '674', 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 0, 1,
                                  1, 1, 1, 0, 0, 0, 0, 0, 0
                              ],
                              [
                                  '686', 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 0, 1,
                                  1, 1, 1, 0, 0, 0, 0, 0, 0
                              ],
                              [
                                  '671', 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 0, 0,
                                  1, 1, 1, 0, 0, 0, 0, 0, 0
                              ],
                              [
                                  '670', 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 0, 1,
                                  0, 0, 1, 0, 0, 0, 0, 0, 0
                              ],
                              [
                                  '679', 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 1, 0,
                                  0, 0, 0, 0, 0, 0, 0, 0, 0
                              ],
                              [
                                  '682', 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 0, 0, 0,
                                  0, 0, 1, 0, 0, 0, 0, 0, 0
                              ],
                              [
                                  '683', 1, 1, 1, 1, 1, 0, 0, 0, 1, 0, 1, 0, 1,
                                  1, 1, 0, 0, 0, 0, 0, 0, 0
                              ],
                              [
                                  '656', 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 1, 0,
                                  0, 0, 0, 0, 0, 0, 0, 0, 0
                              ],
                              [
                                  '662', 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 1, 0,
                                  0, 0, 0, 0, 0, 0, 0, 0, 0
                              ],
                              [
                                  '681', 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0,
                                  0, 0, 0, 0, 0, 0, 0, 0, 0
                              ],
                              [
                                  '663', 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 1, 0,
                                  0, 0, 0, 0, 0, 0, 0, 0, 0
                              ],
                              [
                                  '654', 1, 0, 0, 1, 1, 1, 1, 1, 0, 1, 0, 0, 0,
                                  1, 1, 0, 0, 0, 0, 0, 0, 0
                              ],
                              [
                                  '676', 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 0, 0, 0,
                                  0, 0, 0, 0, 0, 0, 0, 0, 0
                              ],
                              [
                                  '677', 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0,
                                  0, 0, 0, 0, 0, 0, 0, 0, 0
                              ],
                              [
                                  '657', 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0,
                                  0, 0, 0, 0, 0, 0, 0, 0, 0
                              ],
                              [
                                  '680', 1, 1, 1, 1, 0, 1, 1, 1, 1, 0, 0, 0, 0,
                                  0, 0, 0, 0, 0, 0, 0, 0, 0
                              ],
                              [
                                  '653', 0, 1, 1, 1, 0, 1, 1, 1, 1, 0, 0, 1, 0,
                                  0, 0, 0, 0, 0, 0, 0, 0, 0
                              ],
                              [
                                  '666', 1, 1, 0, 1, 1, 1, 1, 1, 0, 1, 0, 0, 0,
                                  0, 0, 0, 0, 0, 0, 0, 0, 0
                              ],
                              [
                                  '675', 1, 1, 1, 1, 1, 1, 1, 0, 1, 0, 0, 0, 0,
                                  0, 0, 0, 0, 0, 0, 0, 0, 0
                              ],
                              [
                                  '669', 1, 1, 1, 1, 1, 1, 1, 0, 1, 0, 0, 0, 0,
                                  0, 0, 0, 0, 0, 0, 0, 0, 0
                              ],
                              [
                                  '690', 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0,
                                  0, 0, 0, 0, 0, 0, 0, 0, 0
                              ],
                              [
                                  '652', 1, 1, 1, 1, 0, 0, 0, 1, 1, 1, 0, 0, 0,
                                  0, 0, 0, 0, 0, 0, 0, 0, 0
                              ],
                              [
                                  '684', 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0,
                                  0, 0, 0, 0, 0, 0, 0, 0, 0
                              ],
                              [
                                  '678', 1, 1, 1, 0, 1, 0, 0, 1, 1, 0, 1, 0, 0,
                                  0, 0, 0, 0, 0, 0, 0, 0, 0
                              ],
                              [
                                  '687', 1, 1, 1, 0, 1, 0, 0, 1, 1, 0, 1, 0, 0,
                                  0, 0, 0, 0, 0, 0, 0, 0, 0
                              ],
                              [
                                  '658', 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0,
                                  0, 0, 0, 0, 0, 0, 0, 0, 0
                              ],
                              [
                                  '655', 1, 1, 0, 1, 0, 1, 1, 1, 0, 0, 0, 0, 0,
                                  0, 0, 0, 0, 0, 0, 0, 0, 0
                              ],
                              [
                                  '659', 1, 1, 1, 0, 0, 0, 0, 1, 1, 0, 0, 0, 1,
                                  0, 0, 0, 0, 0, 0, 0, 0, 0
                              ],
                              [
                                  '685', 1, 1, 1, 0, 1, 0, 0, 1, 0, 0, 0, 1, 0,
                                  0, 0, 0, 0, 0, 0, 0, 0, 0
                              ],
                              [
                                  '673', 1, 0, 1, 1, 0, 1, 1, 0, 0, 0, 0, 0, 0,
                                  0, 0, 0, 0, 0, 0, 0, 0, 0
                              ],
                              [
                                  '651', 1, 1, 1, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0,
                                  0, 0, 0, 0, 0, 0, 0, 0, 0
                              ],
                              [
                                  '661', 1, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0,
                                  0, 0, 0, 0, 0, 0, 0, 0, 0
                              ],
                              [
                                  '688', 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0,
                                  0, 0, 0, 0, 0, 0, 0, 0, 0
                              ],
                              [
                                  '667', 1, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0,
                                  0, 0, 0, 0, 0, 0, 0, 0, 0
                              ],
                              [
                                  '660', 1, 1, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0,
                                  0, 0, 0, 0, 0, 0, 0, 0, 0
                              ],
                              [
                                  '668', 1, 1, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0,
                                  0, 0, 0, 0, 0, 0, 0, 0, 0
                              ],
                              [
                                  '672', 0, 0, 0, 1, 0, 1, 1, 0, 0, 0, 0, 0, 0,
                                  0, 0, 0, 0, 0, 0, 0, 0, 0
                              ],
                              [
                                  '689', 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
                                  0, 0, 0, 0, 0, 0, 0, 0, 0
                              ],
                              [
                                  '665', 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
                                  0, 0, 0, 0, 0, 0, 0, 0, 0
                              ]]
        # Data after cleaning. The data that is supposed to be parsed to Guttman Analysis module to process with.
        self.data_shoudlbe = [
            [1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0],
            [1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0],
            [1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0],
            [1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0],
            [1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0],
            [1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
            [1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0],
            [1, 1, 1, 1, 1, 0, 0, 0, 1, 0, 1, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0],
            [1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
            [1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
            [1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
            [1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
            [1, 0, 0, 1, 1, 1, 1, 1, 0, 1, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0],
            [1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
            [1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
            [1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
            [1, 1, 1, 1, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
            [0, 1, 1, 1, 0, 1, 1, 1, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
            [1, 1, 0, 1, 1, 1, 1, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
            [1, 1, 1, 1, 1, 1, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
            [1, 1, 1, 1, 1, 1, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
            [1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
            [1, 1, 1, 1, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
            [1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
            [1, 1, 1, 0, 1, 0, 0, 1, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
            [1, 1, 1, 0, 1, 0, 0, 1, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
            [1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
            [1, 1, 0, 1, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
            [1, 1, 1, 0, 0, 0, 0, 1, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0],
            [1, 1, 1, 0, 1, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
            [1, 0, 1, 1, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
            [1, 1, 1, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
            [1, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
            [1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
            [1, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
            [1, 1, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
            [1, 1, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
            [0, 0, 0, 1, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
            [1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
            [0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
        ]

        self.data_first_row_one = ad.clean_input(self.original_data)
        # Manipulate the data so that the first element in the list has zero standard deviation.
        self.data_first_row_one[0] = [
            1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1
        ]
        # transposed data
        self.transposed_data = ad.transpose_matrix(self.data_shoudlbe)
 def test_transpose(self):
     array = self.array
     array = fi.transpose(array)
     self.assertTrue(array[1][2] == 3)