Move all tests to single directory

This commit is contained in:
KnugiHK
2025-05-07 21:31:29 +08:00
parent 170a108109
commit e2b773eac5
4 changed files with 10 additions and 3 deletions

0
tests/__init__.py Normal file
View File

5
tests/data/contacts.vcf Normal file
View File

@@ -0,0 +1,5 @@
BEGIN:VCARD
VERSION:3.0
FN:Sample Contact
TEL;TYPE=CELL:+85288888888
END:VCARD

View File

@@ -4,7 +4,7 @@ import tempfile
import os
from unittest.mock import patch
from brazilian_number_processing import process_phone_number, process_vcard
from scripts.brazilian_number_processing import process_phone_number, process_vcard
class TestVCardProcessor(unittest.TestCase):
@@ -248,7 +248,7 @@ END:VCARD
output_path = input_path + '.out'
try:
test_args = ['python' if os.name == 'nt' else 'python3', 'brazilian_number_processing.py', input_path, output_path]
test_args = ['python' if os.name == 'nt' else 'python3', 'scripts/brazilian_number_processing.py', input_path, output_path]
# We're just testing that the argument parsing works
subprocess.call(
test_args,

View File

@@ -1,10 +1,12 @@
# from contacts_names_from_vcards import readVCardsFile
import os
from Whatsapp_Chat_Exporter.vcards_contacts import normalize_number, read_vcards_file
def test_readVCardsFile():
assert len(read_vcards_file("contacts.vcf", "973")) > 0
data_dir = os.path.join(os.path.dirname(__file__), "data")
assert len(read_vcards_file(os.path.join(data_dir, "contacts.vcf"), "852")) > 0
def test_create_number_to_name_dicts():
pass