<commit_before>import sys
from PyQt4 import QtGui, QtCore
from cross_section import CrossSectionL
from cross_section_display import *


class MainWindow(QtGui.QMainWindow):
    def __init__(self):
        QtGui.QMainWindow.__init__(self)
        self.resize(400, 400)
        self.setWindowTitle('CrossSectionDisplay3D Test')
        self.splitter_h = QtGui.QSplitter(QtCore.Qt.Horizontal)
        self.setCentralWidget(self.splitter_h)
        self.csd = CrossSectionDisplay3D()
        self.csd.add_to_widget(self.splitter_h)

    def keyPressEvent(self, event):
        if event.key() == QtCore.Qt.Key_Escape:
            self.close()


def test_init_cross_section_display_3d():
    appQt = QtGui.QApplication(sys.argv)
    win = MainWindow()
    win.show()

    cs1 = CrossSectionL(L=10)
    cs2 = CrossSectionL(L=60)
    cs3 = CrossSectionL(L=80)

    win.csd.add_cross_section(cs1)
    win.csd.add_cross_section(cs2)
    win.csd.add_cross_section(cs3)

    # Here we change L *after* the cross section has been added to the
    # CrossSectionDisplay. This is to check that redraw() takes this
    # change into account.
    cs1.L = 40
    win.csd.redraw()

    appQt.exec_()


if __name__ == '__main__':
    test_init_cross_section_display_3d()
<commit_msg>Draw another cross section in general position in test.<commit_after>import sys
from PyQt4 import QtGui, QtCore
from cross_section import CrossSection, CrossSectionL, Plane
from cross_section_display import *


class MainWindow(QtGui.QMainWindow):
    def __init__(self):
        QtGui.QMainWindow.__init__(self)
        self.resize(400, 400)
        self.setWindowTitle('CrossSectionDisplay3D Test')
        self.splitter_h = QtGui.QSplitter(QtCore.Qt.Horizontal)
        self.setCentralWidget(self.splitter_h)
        self.csd = CrossSectionDisplay3D()
        self.csd.add_to_widget(self.splitter_h)

    def keyPressEvent(self, event):
        if event.key() == QtCore.Qt.Key_Escape:
            self.close()


def test_init_cross_section_display_3d():
    appQt = QtGui.QApplication(sys.argv)
    win = MainWindow()
    win.show()

    cs1 = CrossSectionL(L=10)
    cs2 = CrossSectionL(L=60)
    cs3 = CrossSectionL(L=80)
    cs4 = CrossSection(Plane(P=[50, 0, 0], n=[2, 4, -3]))

    win.csd.add_cross_section(cs1)
    win.csd.add_cross_section(cs2)
    win.csd.add_cross_section(cs3)
    win.csd.add_cross_section(cs4)

    # Here we change L *after* the cross section has been added to the
    # CrossSectionDisplay. This is to check that redraw() takes this
    # change into account.
    cs1.L = 40
    win.csd.redraw()

    appQt.exec_()


if __name__ == '__main__':
    test_init_cross_section_display_3d()

{'fraction_non_alphanumeric': 0.10067114093959731, 'fraction_numerical': 0.02274422073079791, 'mean_word_length': 3.3555194805194803, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '899616', 'n_tokens_mistral': 963, 'n_tokens_neox': 920, 'n_words': 188}