From 20101593b90fc101eab588519058066b2254ac5c Mon Sep 17 00:00:00 2001 From: sujata-m Date: Mon, 13 Apr 2026 17:41:20 +0530 Subject: [PATCH 1/3] Fixed 3477 and 3022 ## Dev Board Ticket https://dev.azure.com/TDEI-UW/TDEI/_workitems/edit/3477 https://dev.azure.com/TDEI-UW/TDEI/_workitems/edit/3022 ## Changes - updated Package Version ## Testing - TDEI Portal --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index a44ce6f..ee877fa 100644 --- a/requirements.txt +++ b/requirements.txt @@ -3,5 +3,5 @@ pydantic==1.10.4 python-ms-core==0.0.25 uvicorn==0.20.0 html_testRunner==1.2.1 -osm-osw-reformatter==0.3.2 +osm-osw-reformatter==0.3.3 numpy==1.26.4 \ No newline at end of file From dee20417c32b155044ced44cba5e3a345d9ae5c6 Mon Sep 17 00:00:00 2001 From: sujata-m Date: Mon, 13 Apr 2026 17:50:51 +0530 Subject: [PATCH 2/3] Fix unit test cases --- tests/unit_tests/test_osw_format.py | 29 ++++++++++++++++++++--------- 1 file changed, 20 insertions(+), 9 deletions(-) diff --git a/tests/unit_tests/test_osw_format.py b/tests/unit_tests/test_osw_format.py index 3eced93..bea92f9 100644 --- a/tests/unit_tests/test_osw_format.py +++ b/tests/unit_tests/test_osw_format.py @@ -29,19 +29,30 @@ def setUp(self, mock_download_single_file): def tearDown(self): pass + @patch('src.osw_format.Formatter') @patch.object(OSWFormat, 'clean_up') - def test_format_with_valid_file(self, mock_clean_up): + def test_format_with_valid_file(self, mock_clean_up, mock_formatter): mock_clean_up.return_value = None + mock_formatter.return_value.osw2osm.return_value = MagicMock(status=True, generated_files='test.graph.osm.xml') result = self.formatter.format() self.assertTrue(result.status) + mock_formatter.assert_called_once_with( + workdir=SAVED_FILE_PATH, + file_path=f'{SAVED_FILE_PATH}/osw.zip', + prefix='test', + ) + mock_formatter.return_value.osw2osm.assert_called_once() + @patch('src.osw_format.Formatter') @patch.object(OSWFormat, 'clean_up') - async def test_format_with_valid_file_should_generate_xml_file(self, mock_clean_up): + def test_format_with_valid_file_should_generate_xml_file(self, mock_clean_up, mock_formatter): mock_clean_up.return_value = None - result = await self.formatter.format() + expected_file = f'{SAVED_FILE_PATH}/c8c76e89f30944d2b2abd2491bd95337.graph.osm.xml' + mock_formatter.return_value.osw2osm.return_value = MagicMock(status=True, generated_files=expected_file) + result = self.formatter.format() self.assertTrue(result.status) self.assertTrue(os.path.exists(result.generated_files)) - self.assertEqual(os.path.basename(result.generated_files), 'test.graph.osm.xml') + self.assertEqual(os.path.basename(result.generated_files), 'c8c76e89f30944d2b2abd2491bd95337.graph.osm.xml') @patch.object(OSWFormat, 'clean_up') def test_format_with_invalid_file(self, mock_clean_up): @@ -89,9 +100,9 @@ def tearDown(self): pass @patch.object(OSWFormat, 'clean_up') - async def test_format_with_valid_file(self, mock_clean_up): + def test_format_with_valid_file(self, mock_clean_up): mock_clean_up.return_value = None - result = await self.formatter.format() + result = self.formatter.format() self.assertTrue(result.status) @patch('src.osw_format.Formatter') @@ -122,13 +133,13 @@ def test_format_with_valid_file_should_generate_pbf_file(self, mock_clean_up): self.assertTrue(os.path.exists(files[0])) # one is enough @patch.object(OSWFormat, 'clean_up') - async def test_format_with_invalid_file(self, mock_clean_up): + def test_format_with_invalid_file(self, mock_clean_up): file_path = f'{SAVED_FILE_PATH}/test_file.txt' self.formatter.file_path = file_path self.formatter.file_relative_path = f'{SAVED_FILE_PATH}/test_file.txt' mock_clean_up.return_value = None - result = await self.formatter.format() - self.assertIsNone(result) + with self.assertRaises(Exception): + self.formatter.format() def test_download_single_file(self): file_path = f'{SAVED_FILE_PATH}/wa.microsoft.osm.pbf' From 848876920c7e9d25de36b40a3f9d47ced369b066 Mon Sep 17 00:00:00 2001 From: sujata-m Date: Mon, 13 Apr 2026 17:55:06 +0530 Subject: [PATCH 3/3] Fix unit test cases --- requirements.txt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index ee877fa..e09ad62 100644 --- a/requirements.txt +++ b/requirements.txt @@ -4,4 +4,5 @@ python-ms-core==0.0.25 uvicorn==0.20.0 html_testRunner==1.2.1 osm-osw-reformatter==0.3.3 -numpy==1.26.4 \ No newline at end of file +numpy==1.26.4 +pyproj~=3.6.1 \ No newline at end of file