Skip to content
This repository has been archived by the owner on Nov 23, 2024. It is now read-only.

Commit

Permalink
refactor: linter
Browse files Browse the repository at this point in the history
  • Loading branch information
Marsmaennchen221 committed May 8, 2024
1 parent 8b7efac commit 6d897d0
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions tests/safeds_datasets/image/_mnist/test_mnist.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@

class TestMNIST:

def test_should_download_and_return_mnist(self):
def test_should_download_and_return_mnist(self) -> None:
with tempfile.TemporaryDirectory() as tmpdirname:
train, test = load_mnist(tmpdirname, True)
train, test = load_mnist(tmpdirname, download=True)
files = os.listdir(Path(tmpdirname) / _mnist._mnist._mnist_folder)
for mnist_file in _mnist._mnist._mnist_files.values():
assert mnist_file in files
Expand All @@ -24,17 +24,17 @@ def test_should_download_and_return_mnist(self):
test_output = test.get_output()
assert set(train_output.get_unique_values()) == set(test_output.get_unique_values()) == set(_mnist._mnist._mnist_labels.values())

def test_should_raise_if_file_not_found(self):
def test_should_raise_if_file_not_found(self) -> None:
with tempfile.TemporaryDirectory() as tmpdirname:
with pytest.raises(FileNotFoundError):
load_mnist(tmpdirname, False)
load_mnist(tmpdirname, download=False)


class TestFashionMNIST:

def test_should_download_and_return_mnist(self):
def test_should_download_and_return_mnist(self) -> None:
with tempfile.TemporaryDirectory() as tmpdirname:
train, test = load_fashion_mnist(tmpdirname, True)
train, test = load_fashion_mnist(tmpdirname, download=True)
files = os.listdir(Path(tmpdirname) / _mnist._mnist._fashion_mnist_folder)
for mnist_file in _mnist._mnist._fashion_mnist_files.values():
assert mnist_file in files
Expand All @@ -46,17 +46,17 @@ def test_should_download_and_return_mnist(self):
test_output = test.get_output()
assert set(train_output.get_unique_values()) == set(test_output.get_unique_values()) == set(_mnist._mnist._fashion_mnist_labels.values())

def test_should_raise_if_file_not_found(self):
def test_should_raise_if_file_not_found(self) -> None:
with tempfile.TemporaryDirectory() as tmpdirname:
with pytest.raises(FileNotFoundError):
load_fashion_mnist(tmpdirname, False)
load_fashion_mnist(tmpdirname, download=False)


class TestKMNIST:

def test_should_download_and_return_mnist(self):
def test_should_download_and_return_mnist(self) -> None:
with tempfile.TemporaryDirectory() as tmpdirname:
train, test = load_kmnist(tmpdirname, True)
train, test = load_kmnist(tmpdirname, download=True)
files = os.listdir(Path(tmpdirname) / _mnist._mnist._kuzushiji_mnist_folder)
for mnist_file in _mnist._mnist._kuzushiji_mnist_files.values():
assert mnist_file in files
Expand All @@ -68,7 +68,7 @@ def test_should_download_and_return_mnist(self):
test_output = test.get_output()
assert set(train_output.get_unique_values()) == set(test_output.get_unique_values()) == set(_mnist._mnist._kuzushiji_mnist_labels.values())

def test_should_raise_if_file_not_found(self):
def test_should_raise_if_file_not_found(self) -> None:
with tempfile.TemporaryDirectory() as tmpdirname:
with pytest.raises(FileNotFoundError):
load_kmnist(tmpdirname, False)
load_kmnist(tmpdirname, download=False)

0 comments on commit 6d897d0

Please sign in to comment.