Beispiel #1
0
def test_preprocessInapproriateData(qtbot):
    """
	UC-3-02

	Melakukan praproses setelah memasukkan berkas yang tidak sesuai
	"""
    testID = "UC-3-02"
    testName = "Melakukan praproses setelah memasukkan berkas yang tidak sesuai"
    print("\n" + testID + "\n" + testName)

    window = AppWindow()
    window.show()
    qtbot.addWidget(window)
    qtbot.waitForWindowShown(window)
    filepath = "G:/Kuliah/Skripsi/Program/data/WordList.txt"
    importer = DataImporter(filepath)
    window.data = importer.get_data()
    window.preprocess_data()
    window.msg.done(1)

    assert window.msg is not None
    assert window.msg.windowTitle() == "Warning"
    assert window.msg.text() == "Anda harus mengimpor data terlebih dahulu"
    assert window.data is None

    print(f"{testID} passed")
Beispiel #2
0
def test_importExceptExcelFile(qtbot):
    """
	UC-2-03

	Memasukkan berkas berekstensi selain .xlsx
	"""
    testID = "UC-2-03"
    testName = "Memasukkan berkas berekstensi selain .xlsx"
    print("\n" + testID + "\n" + testName)

    window = AppWindow()
    window.show()
    qtbot.addWidget(window)
    qtbot.waitForWindowShown(window)
    filepath = "G:/Kuliah/Skripsi/Program/data/WordList.txt"
    importer = DataImporter(filepath)
    window.data = importer.get_data()
    window.renderTable(window.data)
    window.msg.done(1)

    assert window.msg is not None
    assert window.msg.windowTitle() == "Warning"
    assert window.msg.text() == "File tidak memiliki kolom Review dan Label"

    print(f"{testID} passed")
Beispiel #3
0
def test_importExcelWithoutLabelColumn(qtbot):
    """
	UC-2-02

	Memasukkan berkas berekstensi .xlsx yang memiliki
	kolom review tapi tidak memiliki kolom label
	"""
    testID = "UC-2-02"
    testName = "Memasukkan berkas berekstensi .xlsx yang memiliki kolom review tapi tidak memiliki kolom label"
    print("\n" + testID + "\n" + testName)

    window = AppWindow()
    window.show()
    qtbot.addWidget(window)
    qtbot.waitForWindowShown(window)
    filepath = "G:/Kuliah/Skripsi/Program/data/dummy_without_label_test.xlsx"
    importer = DataImporter(filepath)
    window.data = importer.get_data()
    window.renderTable(window.data)
    window.msg.done(1)
    assert window.msg is not None
    assert window.msg.windowTitle() == "Warning"
    assert window.msg.text() == "File tidak memiliki kolom Review dan Label"

    print(f"{testID} passed")
Beispiel #4
0
def test_importCorrectExcelFile(qtbot):
    """
	UC-2-01

	Memasukkan berkas berekstensi .xlsx yang memiliki
	kolom review dan label
	"""
    testID = "UC-2-01"
    testName = "Memasukkan berkas berekstensi .xlsx yang memiliki kolom review dan label"
    print("\n" + testID + "\n" + testName)

    window = AppWindow()
    window.show()
    qtbot.addWidget(window)
    qtbot.waitForWindowShown(window)
    filepath = "G:/Kuliah/Skripsi/Program/data/dummy_test.xlsx"
    importer = DataImporter(filepath)
    window.data = importer.get_data()
    window.renderTable(window.data)

    assert window.tableWidget.rowCount() == 4

    assert window.tableWidget.item(0, 0).text(
    ) == "Ojek online mudah dijangkau dan dapat dipesan dengan aplikasi"
    assert window.tableWidget.item(
        1, 0).text() == "Harga yang disediakan ojek online sangat terjangkau"
    assert window.tableWidget.item(
        2, 0).text() == "Jasa ojek online tidak boleh melanggar undang-undang"
    assert window.tableWidget.item(3, 0).text(
    ) == "Bisnis transportasi roda dua seperti ojek online sudah ada di beberapa negara"

    assert window.tableWidget.item(0, 1).text() == "Berdampak positif"
    assert window.tableWidget.item(1, 1).text() == "Berdampak positif"
    assert window.tableWidget.item(2, 1).text() == "Berdampak negatif"
    assert window.tableWidget.item(3, 1).text() == "Netral"

    print(f"{testID} passed")
Beispiel #5
0
def test_preprocessData(qtbot):
    """
	UC-3-01

	Melakukan praproses setelah memasukkan berkas yang sesuai
	"""
    testID = "UC-3-01"
    testName = "Melakukan praproses setelah memasukkan berkas yang sesuai"
    print("\n" + testID + "\n" + testName)

    window = AppWindow()
    window.show()
    qtbot.addWidget(window)
    qtbot.waitForWindowShown(window)
    filepath = "G:/Kuliah/Skripsi/Program/data/dummy_test.xlsx"
    importer = DataImporter(filepath)
    window.data = importer.get_data()
    window.renderTable(window.data)

    preprocessor = Preprocessor()

    assert preprocessor.preprocess(window.data["Review"][0]) == [
        "ojek", "online", "mudah", "jangkau", "pes", "aplikasi"
    ]
    assert preprocessor.preprocess(window.data["Review"][1]) == [
        "harga", "sedia", "ojek", "online", "sangat", "jangkau"
    ]
    assert preprocessor.preprocess(window.data["Review"][2]) == [
        "jasa", "ojek", "online", "langgar", "undang"
    ]
    assert preprocessor.preprocess(window.data["Review"][3]) == [
        "bisnis", "transportasi", "roda", "ojek", "online", "beberapa",
        "negara"
    ]

    print(f"{testID} passed")
Beispiel #6
0
#         self.initUI()

#     def initUI(self):
#         self.setWindowTitle(self.title)
#         self.setGeometry(self.left, self.top, self.width, self.height)
#         button = QPushButton("Classify", self)
#         button.setToolTip("This is an example button")
#         button.move(100, 70)
#         button.clicked.connect(self.classify)
#         self.textbox = QLineEdit(self)
#         self.textbox.move(100, 30)
#         self.textbox.resize(280, 20)
#         self.show()

#     @pyqtSlot()
#     def classify(self):
#     	self.statusBar().showMessage("Classifying...")

# if __name__ == '__main__':
#     app = QApplication(sys.argv)
#     ex = App()
#     sys.exit(app.exec_())

import sys
from boundaries.AppWindow import AppWindow
from PyQt5.QtWidgets import QApplication

if __name__ == "__main__":
    app = QApplication(sys.argv)
    window = AppWindow()
    sys.exit(app.exec_())
Beispiel #7
0
def run():
    app = QApplication(sys.argv)
    window = AppWindow()
    sys.exit(app.exec_())