Skip to content

Commit

Permalink
Removed unused file_opener
Browse files Browse the repository at this point in the history
  • Loading branch information
DomInvivo committed Jun 27, 2024
1 parent 7f5f2b8 commit 706bc63
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 199 deletions.
173 changes: 0 additions & 173 deletions graphium/utils/read_file.py

This file was deleted.

26 changes: 0 additions & 26 deletions tests/test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -150,32 +150,6 @@ def test_nan_mad(self):
np.testing.assert_almost_equal(torch_mad.numpy(), numpy_mad, decimal=4, err_msg=err_msg)


def test_file_opener(tmp_path):
# Create a temporary file
txt_file = tmp_path / "test.txt"
txt_file.write_text("Hello, World!")

# Test opening file in read mode
with file_opener(txt_file, "r") as f:
assert f.read() == "Hello, World!"

# Test opening file in write mode
with file_opener(txt_file, "w") as f:
f.write("New text")

with file_opener(txt_file, "r") as f:
assert f.read() == "New text"

# Create a temporary gzip file
gzip_file = tmp_path / "test.txt.gz"
with gzip.open(gzip_file, "wt") as f:
f.write("Hello, Gzip!")

# Test opening gzip file in read mode
with file_opener(gzip_file, "r") as f:
assert f.read() == "Hello, Gzip!"


class test_SafeRun(ut.TestCase):
def test_safe_run(self):
# Error is caught
Expand Down

0 comments on commit 706bc63

Please sign in to comment.