Esempio n. 1
0
def run():
    args = args_helper.get_args()

    chats = parser.load(args)
    results = analyzer.analyze(chats, args)
    visualizer.output(results, args)

    print("All is done")
Esempio n. 2
0
    def test_run_all_analyses(self, out_format):
        all_analysis = [AnalysisArgs(t, params) for t in AnalysisType]
        path = get_test_path("*.txt")
        args = AppArgs(path, get_test_path("."), out_format, all_analysis)

        chats = load(args)
        results = analyze(chats, args)
        assert results is not None

        output(results, args)
Esempio n. 3
0
    def test_parser(self):
        file_path = get_test_path("chat_simple_1.txt")
        args = AppArgs(file_path, "", None, [])
        chats = parser.load(args)
        assert len(chats) == 1

        chat = chats[0]
        assert len(chat.participants) == 3
        assert len(chat.messages) == 3

        assert chat.participants[0] == "User One"
        assert chat.participants[1] == "User Two"
        assert chat.participants[2] == "User 3"

        assert chat.messages[0].date == datetime(2019, 11, 24, 12, 1)
        assert chat.messages[0].text == "Lorem"
        assert chat.messages[0].sender == "User One"

        assert "риб" in chat.messages[1].text
        assert chat.messages[2].text == "dolor sit amet"
Esempio n. 4
0
 def test_parsing_wildcard(self):
     file_path = get_test_path("chat_simple_*.txt")
     args = AppArgs(file_path, "", None, [])
     chats = parser.load(args)
     assert len(chats) == 2
Esempio n. 5
0
 def test_parsing_no_file(self):
     file_path = get_test_path("not_exist_file.txt")
     args = AppArgs(file_path, "", None, [])
     with pytest.raises(Exception):
         parser.load(args)