Quellcodebibliothek Statistik Leitseite products/Sources/formale Sprachen/C/Linux/arch/arm/boot/dts/broadcom/   (Browser von der Mozilla Stiftung Version 136.0.1©)  Datei vom 24.10.2025 mit Größe 2 kB image not shown  

Quelle  tTest.py   Sprache: unbekannt

 
# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*-
#
# This file is part of the LibreOffice project.
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
#
from uitest.framework import UITestCase
from uitest.uihelper.calc import enter_text_to_cell

from libreoffice.calc.document import get_cell_by_position
from libreoffice.uno.propertyvalue import mkPropertyValues


class tTest(UITestCase):
    def test_tTest_column(self):
        with self.ui_test.create_doc_in_start_center("calc"as document:
            xCalcDoc = self.xUITest.getTopFocusWindow()
            gridwin = xCalcDoc.getChild("grid_window")
            #fill data
            enter_text_to_cell(gridwin, "A1""28")
            enter_text_to_cell(gridwin, "A2""26")
            enter_text_to_cell(gridwin, "A3""31")
            enter_text_to_cell(gridwin, "A4""23")
            enter_text_to_cell(gridwin, "A5""20")
            enter_text_to_cell(gridwin, "A6""27")
            enter_text_to_cell(gridwin, "A7""28")
            enter_text_to_cell(gridwin, "A8""14")
            enter_text_to_cell(gridwin, "A9""4")
            enter_text_to_cell(gridwin, "A10""0")
            enter_text_to_cell(gridwin, "A11""2")
            enter_text_to_cell(gridwin, "A12""8")
            enter_text_to_cell(gridwin, "A13""9")

            enter_text_to_cell(gridwin, "B1""19")
            enter_text_to_cell(gridwin, "B2""13")
            enter_text_to_cell(gridwin, "B3""12")
            enter_text_to_cell(gridwin, "B4""5")
            enter_text_to_cell(gridwin, "B5""34")
            enter_text_to_cell(gridwin, "B6""31")
            enter_text_to_cell(gridwin, "B7""31")
            enter_text_to_cell(gridwin, "B8""12")
            enter_text_to_cell(gridwin, "B9""24")
            enter_text_to_cell(gridwin, "B10""23")
            enter_text_to_cell(gridwin, "B11""19")
            enter_text_to_cell(gridwin, "B12""10")
            enter_text_to_cell(gridwin, "B13""33")

            gridwin.executeAction("SELECT", mkPropertyValues({"RANGE""A1:B13"}))
            with self.ui_test.execute_modeless_dialog_through_command(".uno:TTestDialog"as xDialog:
                xvariable1rangeedit = xDialog.getChild("variable1-range-edit")
                xvariable2rangeedit = xDialog.getChild("variable2-range-edit")
                xoutputrangeedit = xDialog.getChild("output-range-edit")
                xgroupedbycolumnsradio = xDialog.getChild("groupedby-columns-radio")

                xvariable1rangeedit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"}))
                xvariable1rangeedit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"}))
                xvariable1rangeedit.executeAction("TYPE", mkPropertyValues({"TEXT":"$Sheet1.$A$1:$A$13"}))
                xvariable2rangeedit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"}))
                xvariable2rangeedit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"}))
                xvariable2rangeedit.executeAction("TYPE", mkPropertyValues({"TEXT":"$Sheet1.$B$1:$B$13"}))
                xoutputrangeedit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"}))
                xoutputrangeedit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"}))
                xoutputrangeedit.executeAction("TYPE", mkPropertyValues({"TEXT":"F1"}))
                xgroupedbycolumnsradio.executeAction("CLICK", tuple())
            #Verify
            self.assertEqual(get_cell_by_position(document, 050).getString(), "Paired t-test")
            self.assertEqual(get_cell_by_position(document, 051).getString(), "Alpha")
            self.assertEqual(get_cell_by_position(document, 052).getString(), "Hypothesized Mean Difference")
            self.assertEqual(get_cell_by_position(document, 054).getString(), "Mean")
            self.assertEqual(get_cell_by_position(document, 055).getString(), "Variance")
            self.assertEqual(get_cell_by_position(document, 056).getString(), "Observations")
            self.assertEqual(get_cell_by_position(document, 057).getString(), "Pearson Correlation")
            self.assertEqual(get_cell_by_position(document, 058).getString(), "Observed Mean Difference")
            self.assertEqual(get_cell_by_position(document, 059).getString(), "Variance of the Differences")
            self.assertEqual(get_cell_by_position(document, 0510).getString(), "df")
            self.assertEqual(get_cell_by_position(document, 0511).getString(), "t Stat")
            self.assertEqual(get_cell_by_position(document, 0512).getString(), "P (T<=t) one-tail")
            self.assertEqual(get_cell_by_position(document, 0513).getString(), "t Critical one-tail")
            self.assertEqual(get_cell_by_position(document, 0514).getString(), "P (T<=t) two-tail")
            self.assertEqual(get_cell_by_position(document, 0515).getString(), "t Critical two-tail")

            self.assertEqual(get_cell_by_position(document, 061).getValue(), 0.05)
            self.assertEqual(get_cell_by_position(document, 062).getValue(), 0)
            self.assertEqual(get_cell_by_position(document, 063).getString(), "Variable 1")
            self.assertEqual(round(get_cell_by_position(document, 064).getValue(),12), 16.923076923077)
            self.assertEqual(round(get_cell_by_position(document, 065).getValue(),12), 125.076923076923)
            self.assertEqual(get_cell_by_position(document, 066).getValue(), 13)
            self.assertEqual(round(get_cell_by_position(document, 067).getValue(),12), -0.061753977175)
            self.assertEqual(round(get_cell_by_position(document, 068).getValue(),12), -3.538461538462)
            self.assertEqual(round(get_cell_by_position(document, 069).getValue(),12), 232.935897435897)
            self.assertEqual(get_cell_by_position(document, 0610).getValue(), 12)
            self.assertEqual(round(get_cell_by_position(document, 0611).getValue(),12), -0.835926213674)
            self.assertEqual(round(get_cell_by_position(document, 0612).getValue(),12), 0.209765144211)
            self.assertEqual(round(get_cell_by_position(document, 0613).getValue(),12), 1.782287555649)
            self.assertEqual(round(get_cell_by_position(document, 0614).getValue(),12), 0.419530288422)
            self.assertEqual(round(get_cell_by_position(document, 0615).getValue(),12), 2.178812829667)

            self.assertEqual(get_cell_by_position(document, 073).getString(), "Variable 2")
            self.assertEqual(round(get_cell_by_position(document, 074).getValue(),12), 20.461538461538)
            self.assertEqual(round(get_cell_by_position(document, 075).getValue(),12), 94.435897435897)
            self.assertEqual(get_cell_by_position(document, 076).getValue(), 13)
            #undo
            self.xUITest.executeCommand(".uno:Undo")
            self.assertEqual(get_cell_by_position(document, 050).getString(), "")

            # test cancel button
            with self.ui_test.execute_modeless_dialog_through_command(".uno:TTestDialog", close_button="cancel"):
                pass

# vim: set shiftwidth=4 softtabstop=4 expandtab:

Messung V0.5 in Prozent
C=89 H=100 G=94

[Dauer der Verarbeitung: 0.8 Sekunden, vorverarbeitet 2026-06-10]