From 23b90d9b545803840d7f612b283f6f20e4df3ac1 Mon Sep 17 00:00:00 2001 From: ninsbl Date: Tue, 1 Oct 2024 22:41:43 +0200 Subject: [PATCH] add test for single zip --- src/general/g.unzip/testsuite/test_g_unzip.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/general/g.unzip/testsuite/test_g_unzip.py b/src/general/g.unzip/testsuite/test_g_unzip.py index 1232209c..7a4fb25d 100644 --- a/src/general/g.unzip/testsuite/test_g_unzip.py +++ b/src/general/g.unzip/testsuite/test_g_unzip.py @@ -53,6 +53,22 @@ def test_g_unzip_no_out_dir(self): len(list((self.tempdir / "testdir").glob("testfile_*.txt"))) == 4 ) + def test_g_unzip_single_zip(self): + """Test unzipping a single zip file""" + # Check that zip-files are created + self.assertTrue(len(list(self.tempdir.glob("testfile_*.zip"))) == 4) + # Check that g.unzip runs successfully + self.assertModule( + "g.unzip", + input=str(self.tempdir / "testfile_1.zip"), + output=str(self.tempdir / "testdir_file"), + verbose=True, + ) + # Check that unzipped-files exist in the file system + self.assertFileExists( + str(self.tempdir / "testdir_file" / "testdir" / "testfile_1.txt") + ) + def test_g_unzip_empty_dir(self): """Test unzipping if input directory is empty (should not fail)""" # Check that zip-files are created