Skip to content

Commit 5303263

Browse files
author
John Wu
committed
remove extra nonsense from Claude
1 parent ffe1cd1 commit 5303263

1 file changed

Lines changed: 18 additions & 28 deletions

File tree

tests/core/test_mimic3.py

Lines changed: 18 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -11,26 +11,18 @@
1111
class TestMIMIC3Demo(unittest.TestCase):
1212
"""Test MIMIC3 dataset with demo data downloaded from PhysioNet."""
1313

14-
# Class-level variables for shared dataset
15-
temp_dir = None
16-
demo_dataset_path = None
17-
dataset = None
18-
19-
@classmethod
20-
def setUpClass(cls):
21-
"""Download demo dataset once for all tests."""
22-
cls.temp_dir = tempfile.mkdtemp()
23-
cls._download_demo_dataset()
24-
cls._load_dataset()
25-
26-
@classmethod
27-
def tearDownClass(cls):
28-
"""Clean up downloaded dataset after all tests."""
29-
if cls.temp_dir and os.path.exists(cls.temp_dir):
30-
shutil.rmtree(cls.temp_dir)
31-
32-
@classmethod
33-
def _download_demo_dataset(cls):
14+
def setUp(self):
15+
"""Download and set up demo dataset for each test."""
16+
self.temp_dir = tempfile.mkdtemp()
17+
self._download_demo_dataset()
18+
self._load_dataset()
19+
20+
def tearDown(self):
21+
"""Clean up downloaded dataset after each test."""
22+
if self.temp_dir and os.path.exists(self.temp_dir):
23+
shutil.rmtree(self.temp_dir)
24+
25+
def _download_demo_dataset(self):
3426
"""Download MIMIC-III demo dataset using wget."""
3527
download_url = "https://physionet.org/files/mimiciii-demo/1.4/"
3628

@@ -42,7 +34,7 @@ def _download_demo_dataset(cls):
4234
"-c",
4335
"-np",
4436
"--directory-prefix",
45-
cls.temp_dir,
37+
self.temp_dir,
4638
download_url,
4739
]
4840

@@ -55,19 +47,17 @@ def _download_demo_dataset(cls):
5547

5648
# Find the downloaded dataset path
5749
physionet_dir = (
58-
Path(cls.temp_dir) / "physionet.org" / "files" / "mimiciii-demo" / "1.4"
50+
Path(self.temp_dir) / "physionet.org" / "files" / "mimiciii-demo" / "1.4"
5951
)
6052
if physionet_dir.exists():
61-
cls.demo_dataset_path = str(physionet_dir)
53+
self.demo_dataset_path = str(physionet_dir)
6254
else:
6355
raise unittest.SkipTest("Downloaded dataset not found in expected location")
6456

65-
@classmethod
66-
def _load_dataset(cls):
67-
"""Load the dataset once for all tests."""
57+
def _load_dataset(self):
58+
"""Load the dataset for testing."""
6859
tables = ["diagnoses_icd", "procedures_icd", "prescriptions", "noteevents"]
69-
70-
cls.dataset = MIMIC3Dataset(root=cls.demo_dataset_path, tables=tables)
60+
self.dataset = MIMIC3Dataset(root=self.demo_dataset_path, tables=tables)
7161

7262
def test_stats(self):
7363
"""Test .stats() method execution."""

0 commit comments

Comments
 (0)