Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updates.py #154

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 19 additions & 10 deletions tests/test_allFileMetadata.py
Original file line number Diff line number Diff line change
@@ -1,29 +1,38 @@
import pytest
import os
from twinTrim.dataStructures.allFileMetadata import AllFileMetadata
import pytest

from twinTrim.dataStructures.allFileMetadata import AllFileMetadata

@pytest.fixture
def temp_file(tmp_path):
# Create a temporary file for testing
"""Creates a temporary file with content and returns its path."""
file = tmp_path / "test_file.txt"
file.write_text("Sample content")
return str(file)

def test_get_modification_time_existing_file(temp_file):
"""
Test that the modification time is correctly retrieved for an existing file.
"""
# Arrange
metadata = AllFileMetadata(temp_file)

# Act
modification_time = metadata.get_modification_time()

# Assert
assert modification_time is not None # Replace with appropriate assertion

def test_get_modification_time_non_existing_file():
assert isinstance(modification_time, float), "Expected modification time as a float"
assert modification_time > 0, "Expected a valid modification time, but got 0 or a negative value"

def test_get_modification_time_non_existing_file(tmp_path):
"""
Test that the modification time retrieval returns -1 for a non-existing file.
"""
# Arrange
non_existing_filepath = "path/to/non/existing/file.txt"
metadata = AllFileMetadata(non_existing_filepath)
non_existing_filepath = tmp_path / "non_existent_file.txt"
metadata = AllFileMetadata(str(non_existing_filepath))

# Act
modification_time = metadata.get_modification_time()

# Assert
assert modification_time == -1 # Update the assertion
assert modification_time == -1, "Expected -1 for non-existing file modification time"
Loading