Skip to content

Commit

Permalink
Merge pull request #106 from Sai-ganesh-0004/branch1
Browse files Browse the repository at this point in the history
added test_fileMetadata.py
  • Loading branch information
Kota-Karthik authored Oct 9, 2024
2 parents a4f5f04 + 5cd58c6 commit 92c3996
Showing 1 changed file with 37 additions and 0 deletions.
37 changes: 37 additions & 0 deletions tests/test_fileMetadata.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# test_fileMetadata.py
import pytest
from twinTrim.dataStructures.fileMetadata import FileMetadata

def test_insert_new_file():
# Test inserting a new file into the metadata
metadata = FileMetadata([])
file_path = "C:\\Users\\2004s\\Desktop\\dummy\\dummy_1.txt"

metadata.insert_file(file_path)

assert len(metadata.filepaths) == 1
assert metadata.filepaths[0] == file_path

def test_insert_duplicate_file():
# Test trying to insert a file that is already present
file_path = "C:\\Users\\2004s\\Desktop\\dummy\\dummy_2.txt"
metadata = FileMetadata([file_path])

metadata.insert_file(file_path)

# The file should not be added again
assert len(metadata.filepaths) == 1
assert metadata.filepaths[0] == file_path

def test_insert_multiple_files():
# Test inserting multiple different files
file_path1 = "C:\\Users\\2004s\\Desktop\\dummy\\dummy_3.txt"
file_path2 = "C:\\Users\\2004s\\Desktop\\dummy\\dummy_4.txt"

metadata = FileMetadata([file_path1])

metadata.insert_file(file_path2)

assert len(metadata.filepaths) == 2
assert file_path1 in metadata.filepaths
assert file_path2 in metadata.filepaths

0 comments on commit 92c3996

Please sign in to comment.