DavMelchi commited on
Commit
9a4fe9c
·
1 Parent(s): 4662aef

Introduce Pytest

Browse files
Files changed (2) hide show
  1. test/test.py +48 -0
  2. utils/utils_vars.py +1 -1
test/test.py ADDED
@@ -0,0 +1,48 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import os
2
+
3
+ import pandas as pd
4
+ import pytest
5
+
6
+ from queries.process_all_db import (
7
+ all_dbs,
8
+ process_all_tech_db,
9
+ process_all_tech_db_with_stats,
10
+ )
11
+ from utils.utils_vars import UtilsVars
12
+
13
+
14
+ class TestProcessAllDB:
15
+ def setup_method(self):
16
+ UtilsVars.all_db_dfs = []
17
+ UtilsVars.final_all_database = None
18
+
19
+ def test_all_dbs(self):
20
+ filepath = r"C:\Users\HP\Desktop\LTE\PROJET 2023\DUMP\2024\SEPTEMBRE\20240917_7950_17092024_Dump.xml.gz.xlsb"
21
+ all_dbs(filepath)
22
+ assert len(UtilsVars.all_db_dfs) == 7
23
+ assert isinstance(UtilsVars.all_db_dfs[0], pd.DataFrame)
24
+
25
+ def test_process_all_tech_db(self):
26
+ filepath = r"C:\Users\HP\Desktop\LTE\PROJET 2023\DUMP\2024\SEPTEMBRE\20240917_7950_17092024_Dump.xml.gz.xlsb"
27
+ process_all_tech_db(filepath)
28
+ assert UtilsVars.final_all_database is not None
29
+
30
+ def test_process_all_tech_db_with_stats(self):
31
+ filepath = r"C:\Users\HP\Desktop\LTE\PROJET 2023\DUMP\2024\SEPTEMBRE\20240917_7950_17092024_Dump.xml.gz.xlsb"
32
+ process_all_tech_db_with_stats(filepath)
33
+ assert UtilsVars.final_all_database is not None
34
+
35
+ # def test_all_dbs_empty_file(self):
36
+ # filepath = r"C:\Users\HP\Desktop\LTE\PROJET 2023\DUMP\2024\SEPTEMBRE\empty.xlsb"
37
+ # all_dbs(filepath)
38
+ # assert len(UtilsVars.all_db_dfs) == 0
39
+
40
+ # def test_process_all_tech_db_empty_file(self):
41
+ # filepath = r"C:\Users\HP\Desktop\LTE\PROJET 2023\DUMP\2024\SEPTEMBRE\empty.xlsb"
42
+ # process_all_tech_db(filepath)
43
+ # assert UtilsVars.final_all_database is None
44
+
45
+ # def test_process_all_tech_db_with_stats_empty_file(self):
46
+ # filepath = r"C:\Users\HP\Desktop\LTE\PROJET 2023\DUMP\2024\SEPTEMBRE\empty.xlsb"
47
+ # process_all_tech_db_with_stats(filepath)
48
+ # assert UtilsVars.final_all_database is None
utils/utils_vars.py CHANGED
@@ -44,7 +44,7 @@ class UtilsVars:
44
  final_mrbts_database = ""
45
  final_mal_database = ""
46
  all_db_dfs = []
47
- final_all_database = ""
48
  neighbors_database = ""
49
  file_path = ""
50
  physisal_db = get_physical_db()
 
44
  final_mrbts_database = ""
45
  final_mal_database = ""
46
  all_db_dfs = []
47
+ final_all_database = None
48
  neighbors_database = ""
49
  file_path = ""
50
  physisal_db = get_physical_db()