From 35ce3fae5a5470b8eb7c06898eca3a5ea89815d3 Mon Sep 17 00:00:00 2001 From: Chen Heroy Date: Thu, 1 May 2025 08:54:50 -0600 Subject: [PATCH 1/8] update test data commit --- tests/data | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/data b/tests/data index d3cc4d6..ab3a3dd 160000 --- a/tests/data +++ b/tests/data @@ -1 +1 @@ -Subproject commit d3cc4d6efff973b1a4fac4dbf3074439aa3246ba +Subproject commit ab3a3dd5c78e6850bb334a25614613942e7b05be From d848824a259e2609483aa12e82ba086a5f03bdc3 Mon Sep 17 00:00:00 2001 From: Chen Heroy Date: Fri, 9 May 2025 10:14:10 -0600 Subject: [PATCH 2/8] update description --- .zenodo.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.zenodo.json b/.zenodo.json index e4a5acc..833748a 100644 --- a/.zenodo.json +++ b/.zenodo.json @@ -14,7 +14,7 @@ "orcid": "0000-0001-8437-6504" } ], - "description": "This code repository contains a Python wrapper for the NTIA/ITS implementation of the Low Frequency / Medium Frequency (LF/MF) Propagation Model.", + "description": "This code repository contains a Python wrapper for the NTIA/ITS implementation of the Low Frequency / Medium Frequency (LF/MF) Propagation Model. This Python package wraps the NTIA/ITS C++ implementation.", "keywords": [ "propagation", "communications", From b731c301555d46b7c15ea5d017a0346ee14a3f29 Mon Sep 17 00:00:00 2001 From: Chen Heroy Date: Thu, 15 May 2025 10:32:19 -0600 Subject: [PATCH 3/8] update template --- .zenodo.json | 4 +- CITATION.cff | 4 +- CONTRIBUTING.md | 99 +++++++++++++++++------------- GitHubRepoPublicReleaseApproval.md | 10 +-- 4 files changed, 67 insertions(+), 50 deletions(-) diff --git a/.zenodo.json b/.zenodo.json index 09db0cf..8ca254f 100644 --- a/.zenodo.json +++ b/.zenodo.json @@ -1,7 +1,7 @@ { "upload_type": "software", "publication_date": "TODO-TEMPLATE", - "title": "TODO-TEMPLATE", + "title": "TODO-TEMPLATE, Python Wrapper", "creators": [ { "name": "TODO-TEMPLATE", @@ -9,7 +9,7 @@ "orcid": "TODO-TEMPLATE" } ], - "description": "TODO-TEMPLATE. Make this the same as the abstract.", + "description": "This repository contains a Python wrapper for the TODO-TEMPLATE. Make this the same as the abstract. This Python package wraps the NTIA/ITS C++ implementation.", "keywords": [ "TODO-TEMPLATE", "TODO-TEMPLATE" diff --git a/CITATION.cff b/CITATION.cff index 3d07367..449cb9e 100644 --- a/CITATION.cff +++ b/CITATION.cff @@ -24,9 +24,9 @@ authors: alias: NTIA/ITS email: code@ntia.gov website: 'https://its.ntia.gov' -repository-code: 'https://github.com/NTIA/TODO-TEMPLATE' +repository-code: 'https://github.com/NTIA/TODO-TEMPLATE-python' url: 'https://ntia.github.io/propagation-library-wiki/models/TODO-TEMPLATE/' keywords: - propagation - TODO-TEMPLATE -version: 1.0.0 +version: TODO-TEMPLATE diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index f4c5d11..e425fa1 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -51,18 +51,16 @@ When complete, features branches should merge into `dev`. ### Git Submodules -Software in the ITS Propagation Library is implemented primarily in C++. Each piece -of software has a primary repository which contains the base C++ implementation, -test data and resources, and common files used by the multi-language wrappers. -Interfaces for additional programming languages are provided in separate repositories, -which are linked to the primary repository as [Git submodules](https://gist.github.com/gitaarik/8735255). -When cloning the primary repository, the submodules are not additionally cloned -by default. This can be done with the `git submodule init` command. Initializing -the submodule as part of the parent repository will let you use the build -configuration from the primary repository to compile the C++ source and place it -appropriately for use by the wrapper code. If you choose to independently clone -the wrapper repository, you will likely need to separately download the compiled -library (for example, a DLL from a GitHub release). +PropLib C++ repositories make use of Git submodules to reference certain development +dependencies, e.g. GoogleTest. Depending on the CMake preset or options used, submodules +may be required to successfully build and/or test the software. When cloning a repository, +submodules are not additionally cloned by default. Use the following commands to initialize +and clone any submodules in a repository: + +```cmd +git submodule init +git submodule update +``` ### Contributing on GitHub @@ -130,35 +128,27 @@ repository. For details about wrapper repositories, refer to their own README fi ```bash app/ # The command-line driver which can run the library - data/ # Example input and output files for use with the driver include/ # Headers used by the command-line driver src/ # Source code for the command-line driver tests/ # Header and source files for testing the command-line driver CMakeLists.txt # Configuration for the command-line driver and its tests - README.md # Usage information for the command-line driver docs/ CMakeLists.txt # Doxygen configuration ... # Static files (images, HTML, CS, Markdown) used by Doxygen extern/ - ... # External Git submodules/dependencies + test-data/ # Git submodule containing test data files shared with wrappers + ... # Other external Git submodules/dependencies include/ - / # Include namespace folder, e.g. "ITS.Propagation.ITM" - .h # Library header files go here, e.g. "ITM.h" and "ErrorCodes.h" + .h # Library interface header file goes here, e.g. "ITM.h" src/ .cpp # Source files go here, e.g. "LongleyRice.cpp" and "FreeSpaceLoss.cpp" CMakeLists.txt # Configures cross-platform build tests/ - data/ - .csv # Testing data goes here. Does not have to be CSV. .cpp # Unit tests, usually one test file per source file. .h # Any headers used by tests go here as well. CMakeLists.txt # CTest+GTest config. Files containing tests must be included here. -wrap/ - dotnet/ # C#/.NET wrapper submodule. Should contain CMakeLists.txt - matlab/ # MATLAB wrapper submodule. Should contain CMakeLists.txt - python/ # Python wrapper submodule. Should contain CMakeLists.txt CMakeLists.txt # Top-level CMakeLists.txt: project metadata and options -CMakePresets.json # Presets for CMake, e.g. "release", "debug", etc. +CMakePresets.json # Presets for CMake, e.g. "release64", "debug32", etc. ... ``` @@ -179,7 +169,6 @@ The following CMake options are used for top-level project configuration: | `RUN_DRIVER_TESTS` | `ON` | Test the command-line driver executable | | `DOCS_ONLY` | `OFF` | Skip all steps _except_ generating the documentation site | | `RUN_TESTS` | `ON` | Run unit tests for the main library | -| `COPY_TO_WRAPPERS` | `ON` | Copy the compiled shared library into wrapper submodules | [CMake Presets](https://cmake.org/cmake/help/latest/manual/cmake-presets.7.html) are provided to support common build configurations. These are specified in the @@ -202,21 +191,21 @@ generating the Doxygen documentation site. Below are some examples of how CMake can be called to compile this software. ```bash -# Configure and compile in release configuration -cmake --preset release -cmake --build --preset release +# Configure and compile in 64-bit release configuration +cmake --preset release64 +cmake --build --preset release64 -# Use the release configuration but don't build Doxygen docs -cmake --preset release -DBUILD_DOCS=OFF -cmake --build --preset release +# Use the 64-bit release configuration but don't build Doxygen docs +cmake --preset release64 -DBUILD_DOCS=OFF +cmake --build --preset release64 -# Configure and compile in debug configuration -cmake --preset debug -cmake --build --preset debug +# Configure and compile in 32-bit debug configuration +cmake --preset debug32 +cmake --build --preset debug32 -# Use the release configuration but don't run driver tests -cmake --preset release -DRUN_DRIVER_TESTS=OFF -cmake --build --preset release +# Use the 64-bit release configuration but don't run driver tests +cmake --preset release64 -DRUN_DRIVER_TESTS=OFF +cmake --build --preset release64 ``` ### Supported Platforms and Build Options @@ -273,8 +262,36 @@ the Doxygen site to GitHub Pages. ### MATLAB Wrappers -Most code in the MATLAB wrapper is actually written in C. In these files, the same -documentation style as noted above for C++ should be used. +MATLAB® wrappers are implemented as toolboxes which interface with the shared library +compiled from C++ source code. The project structure is informed by the best practices +provided by MathWorks® in their [`toolboxdesign` repository](https://github.com/mathworks/toolboxdesign). +Here is an example of how a function may be documented in a MATLAB wrapper. Note the +documentation with code, where input and output arguments are provided for autocompletion. + +```matlab +function y = DoubleTheInput(x) +% DoubleTheInput - produces an output which is twice its input. +% +% Syntax: +% y = DoubleTheInput(x) +% +% Input Arguments: +% x (double) - A number which needs doubling +% +% Output Arguments: +% y (double) - The result, 2*x +% +% Description: +% Functions more complex than this one may warrant an additional, +% longer description. +arguments (Input) + x double +end +arguments (Output) + y double +end +... +``` ### Python Wrappers @@ -302,9 +319,9 @@ def double_the_input(x: float) -> float: return 2 * x ``` -### C#/.NET Wrappers +### .NET Wrappers -In C#/.NET, documentation comments are written in +PropLib .NET wrappers are written in C# and documentation comments are written in [XML format](https://learn.microsoft.com/en-us/dotnet/csharp/language-reference/language-specification/documentation-comments) and are used to generate documentation through tools like Visual Studio. Use `` tags to provide brief descriptions of classes, constants, functions, etc. Functions should diff --git a/GitHubRepoPublicReleaseApproval.md b/GitHubRepoPublicReleaseApproval.md index 85235a5..9d17b0e 100644 --- a/GitHubRepoPublicReleaseApproval.md +++ b/GitHubRepoPublicReleaseApproval.md @@ -1,8 +1,8 @@ # GitHub Repository Public Release Approval -**Project Name:** NTIA/OSM Research and Development +**Project Name:** NTIA/OSM Research and Development - Propagation Library -**Software Name:** TODO-TEMPLATE +**Software Name:** TODO-TEMPLATE, Python Wrapper The project identified above, which is contained within the repository this document is stored in, has met the following criteria for public release: @@ -18,14 +18,14 @@ mark next to each attests that the criterion has been met. * [ ] The repository includes the appropriate `LICENSE.md` file 2. [ ] Any test data necessary for the code and its unit tests to function is included in this GitHub repository, either directly or as a linked Git submodule. -3. [ ] The README.md file has passed editorial review from the ITS Publications Office. +3. [ ] The README.md file has passed editorial review by the ITS Publications Office. 4. [ ] The project complies with the ITS Code Style Guide or an appropriate style guide as agreed to by the sponsor, project lead, or Supervising Division Chief. 5. [ ] Approved disclaimer and licensing language has been included. In order to complete this approval, please create a new branch, upload and commit -your version of this Markdown document to that branch, then create a pull request -for that branch. The following must login to GitHub and approve that pull request +your version of this Markdown document to that branch, and then create a pull request +for that branch. The following must log in to GitHub and approve that pull request before the pull request can be merged and this repo made public: * Project Lead: TODO-TEMPLATE From f8b9ff08c6f43b33df4e3c4cbdeb6db89bede635 Mon Sep 17 00:00:00 2001 From: Chen Heroy Date: Tue, 20 May 2025 13:53:08 -0600 Subject: [PATCH 4/8] update README template --- README.md | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index fa7d571..6ef88d9 100644 --- a/README.md +++ b/README.md @@ -27,12 +27,12 @@ --> [proplib-badge]: https://img.shields.io/badge/PropLib-badge?label=%F0%9F%87%BA%F0%9F%87%B8%20NTIA%2FITS&labelColor=162E51&color=D63E04 [proplib-link]: https://ntia.github.io/propagation-library-wiki -[gh-actions-test-badge]: https://img.shields.io/github/actions/workflow/status/NTIA/TODO-TEMPLATE/pytest.yml?branch=main&logo=pytest&logoColor=ffffff&label=Tests&labelColor=162E51 -[gh-actions-test-link]: https://github.com/NTIA/TODO-TEMPLATE/actions/workflows/pytest.yml -[pypi-release-badge]: https://img.shields.io/pypi/v/TODO-TEMPLATE?logo=pypi&logoColor=ffffff&label=Release&labelColor=162E51&color=D63E04 -[pypi-release-link]: https://pypi.org/project/TODO-TEMPLATE -[gh-issues-badge]: https://img.shields.io/github/issues/NTIA/TODO-TEMPLATE?logo=github&label=Issues&labelColor=162E51 -[gh-issues-link]: https://github.com/NTIA/TODO-TEMPLATE/issues +[gh-actions-test-badge]: https://img.shields.io/github/actions/workflow/status/NTIA/TODO-TEMPLATE-python/pytest.yml?branch=main&logo=pytest&logoColor=ffffff&label=Tests&labelColor=162E51 +[gh-actions-test-link]: https://github.com/NTIA/TODO-TEMPLATE-python/actions/workflows/pytest.yml +[pypi-release-badge]: https://img.shields.io/pypi/v/proplib-TODO-TEMPLATE?logo=pypi&logoColor=ffffff&label=Release&labelColor=162E51&color=D63E04 +[pypi-release-link]: https://pypi.org/project/proplib-TODO-TEMPLATE +[gh-issues-badge]: https://img.shields.io/github/issues/NTIA/TODO-TEMPLATE-python?logo=github&label=Issues&labelColor=162E51 +[gh-issues-link]: https://github.com/NTIA/TODO-TEMPLATE-python/issues [doi-badge]: https://zenodo.org/badge/TODO-TEMPLATE.svg [doi-link]: https://zenodo.org/badge/latestdoi/TODO-TEMPLATE @@ -69,7 +69,7 @@ This software is distributed on [PyPI](#) and is easily installable using the following command. ```cmd -pip install TODO-TEMPLATE +pip install proplib-TODO-TEMPLATE ``` General information about using this model is available on @@ -79,7 +79,7 @@ Additionally, Python-specific instructions and code examples are available If you're a developer and would like to contribute to or extend this repository, please review the guide for contributors [here](CONTRIBUTING.md) or open an -[issue](https://github.com/NTIA/TODO-TEMPLATE/issues) to start a discussion. +[issue](https://github.com/NTIA/TODO-TEMPLATE-python/issues) to start a discussion. ## Development ## @@ -105,8 +105,8 @@ library from C++ source code; see relevant build instructions ```cmd # Clone the repository - git clone https://github.com/NTIA/TODO-TEMPLATE - cd TODO-TEMPLATE + git clone https://github.com/NTIA/TODO-TEMPLATE-python + cd TODO-TEMPLATE-python # Initialize Git submodule containing test data git submodule init From 038730a62a3d1ca2ca8ceffaa2b827a1b66707c9 Mon Sep 17 00:00:00 2001 From: Chen Heroy Date: Thu, 22 May 2025 11:12:28 -0600 Subject: [PATCH 5/8] add csv_to_test_dict --- pyproject.toml | 4 ++-- tests/test_utils.py | 18 ++++++++++++++++++ 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index f65933e..d89f81c 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -46,8 +46,8 @@ dev = [ [project.urls] "PropLib Wiki" = "https://ntia.github.io/propagation-library-wiki/models/TODO-TEMPLATE/" -"Python Wrapper Source" = "https://github.com/NTIA/TODO-TEMPLATE" -"Python Wrapper Bug Tracker" = "https://github.com/NTIA/TODO-TEMPLATE/issues" +"Python Wrapper Source" = "https://github.com/NTIA/TODO-TEMPLATE-python" +"Python Wrapper Bug Tracker" = "https://github.com/NTIA/TODO-TEMPLATE-python/issues" "C++ Source" = "https://github.com/NTIA/TODO-TEMPLATE" "NTIA GitHub" = "https://github.com/NTIA" "ITS Website" = "https://its.ntia.gov" diff --git a/tests/test_utils.py b/tests/test_utils.py index a107003..8850ea6 100644 --- a/tests/test_utils.py +++ b/tests/test_utils.py @@ -24,6 +24,24 @@ def read_csv_test_data(filename: str): yield tuple(map(float, row[:-2])), int(row[-2]), float(row[-1]) +""" +Read CSV into dictionary and convert to data type +For example: +csv_to_test_dict("TestData.csv", + {"rtn" : int, "input_1" : float, "input_2" : int, "output" : float}), +""" +def csv_to_test_dict(filename, type_dict): + with open(TEST_DATA_DIR / filename, mode='r', encoding='utf_8_sig') as infile: + reader = csv.reader(infile, skipinitialspace=True) + keys = next(reader) + for row in reader: + test_dict = {} + for key, value in zip(keys, row): + if key in type_dict: + test_dict[key] = type_dict[key](value) + yield test_dict + + # TODO-TEMPLATE: Delete this dummy test and write your own in another file. def test_always_pass(): return From 5448d85456d016ffcc7df3be437a61e3242ac86e Mon Sep 17 00:00:00 2001 From: Chen Heroy Date: Thu, 22 May 2025 13:17:52 -0600 Subject: [PATCH 6/8] add convertResultStruct --- src/ITS/Propagation/LFMF/LFMF.py | 27 +++++++++++++++++++++++---- src/ITS/Propagation/LFMF/__init__.py | 2 +- 2 files changed, 24 insertions(+), 5 deletions(-) diff --git a/src/ITS/Propagation/LFMF/LFMF.py b/src/ITS/Propagation/LFMF/LFMF.py index def17a9..4b39d33 100644 --- a/src/ITS/Propagation/LFMF/LFMF.py +++ b/src/ITS/Propagation/LFMF/LFMF.py @@ -4,7 +4,7 @@ from .proplib_loader import PropLibCDLL -class Result(Structure): +class c_LFMFResult(Structure): # C Struct for library outputs _fields_ = [ ("A_btl__db", c_double), @@ -14,6 +14,14 @@ class Result(Structure): ] +class LFMFResult(Structure): + A_btl__db = None + E__dBuVm = None + P_rx__dbm = None + method = None + + + # Load the shared library lib = PropLibCDLL("LFMF-1.1") @@ -29,7 +37,7 @@ class Result(Structure): c_double, c_double, c_int, - POINTER(Result), + POINTER(LFMFResult), ) @@ -48,7 +56,7 @@ def LFMF( epsilon: float, sigma: float, pol: Polarization, -) -> Result: +) -> LFMFResult: """ Compute the Low Frequency / Medium Frequency (LF/MF) propagation prediction @@ -67,7 +75,7 @@ def LFMF( :return: In Result class. """ - result = Result() + result = c_LFMFResult() lib.err_check( lib.LFMF( c_double(h_tx__meter), @@ -83,4 +91,15 @@ def LFMF( ) ) + return __convertResultStruct(result) + + +def __convertResultStruct(c_result): + result = LFMFResult + result.A_gas__db = c_result.A_gas__db + result.bending__rad = c_result.bending__rad + result.a__km = c_result.a__km + result.incident__rad = c_result.incident__rad + result.delta_L__km = c_result.delta_L__km + return result diff --git a/src/ITS/Propagation/LFMF/__init__.py b/src/ITS/Propagation/LFMF/__init__.py index 46ddf3f..051268c 100644 --- a/src/ITS/Propagation/LFMF/__init__.py +++ b/src/ITS/Propagation/LFMF/__init__.py @@ -2,4 +2,4 @@ # and Z is the version of this Python wrapper __version__ = "1.1.0" -from .LFMF import LFMF, Polarization, Result +from .LFMF import LFMF, Polarization, LFMFResult From b82c151ead003b9e46a95db3c0ff98a11ecbf3ba Mon Sep 17 00:00:00 2001 From: Chen Heroy Date: Thu, 22 May 2025 14:50:28 -0600 Subject: [PATCH 7/8] add SolutionMethod enum --- src/ITS/Propagation/LFMF/LFMF.py | 45 +++++++++++++++------------- src/ITS/Propagation/LFMF/__init__.py | 7 ++++- tests/test_lfmf.py | 21 ++++++++----- 3 files changed, 43 insertions(+), 30 deletions(-) diff --git a/src/ITS/Propagation/LFMF/LFMF.py b/src/ITS/Propagation/LFMF/LFMF.py index 4b39d33..50dbaa0 100644 --- a/src/ITS/Propagation/LFMF/LFMF.py +++ b/src/ITS/Propagation/LFMF/LFMF.py @@ -4,22 +4,31 @@ from .proplib_loader import PropLibCDLL +class Polarization(IntEnum): + Horizontal = 0 + Vertical = 1 + + +class SolutionMethod(IntEnum): + FlatEarthCurveCorrection = 0 + ResidueSeries = 1 + + class c_LFMFResult(Structure): # C Struct for library outputs _fields_ = [ - ("A_btl__db", c_double), - ("E__dBuVm", c_double), - ("P_rx__dbm", c_double), - ("method", c_int), + ("A_btl__db", c_double), # Basic transmission loss, in dB + ("E__dBuVm", c_double), # Electic field strength, in db(uV/m) + ("P_rx__dbm", c_double), # Received power, in dBm + ("method", c_int), # Solution method used ] class LFMFResult(Structure): - A_btl__db = None - E__dBuVm = None - P_rx__dbm = None - method = None - + A_btl__db: float = None # Basic transmission loss, in dB + E__dBuVm: float = None # Electic field strength, in db(uV/m) + P_rx__dbm: float = None # Received power, in dBm + method: SolutionMethod = None # Solution method used # Load the shared library @@ -37,15 +46,10 @@ class LFMFResult(Structure): c_double, c_double, c_int, - POINTER(LFMFResult), + POINTER(c_LFMFResult), ) -class Polarization(IntEnum): - Horizontal = 0 - Vertical = 1 - - def LFMF( h_tx__meter: float, h_rx__meter: float, @@ -86,7 +90,7 @@ def LFMF( c_double(d__km), c_double(epsilon), c_double(sigma), - c_int(int(pol)), + c_int(pol), byref(result), ) ) @@ -96,10 +100,9 @@ def LFMF( def __convertResultStruct(c_result): result = LFMFResult - result.A_gas__db = c_result.A_gas__db - result.bending__rad = c_result.bending__rad - result.a__km = c_result.a__km - result.incident__rad = c_result.incident__rad - result.delta_L__km = c_result.delta_L__km + result.A_btl__db = c_result.A_btl__db + result.E__dBuVm = c_result.E__dBuVm + result.P_rx__dbm = c_result.P_rx__dbm + result.method = SolutionMethod(c_result.method) return result diff --git a/src/ITS/Propagation/LFMF/__init__.py b/src/ITS/Propagation/LFMF/__init__.py index 051268c..a0bde28 100644 --- a/src/ITS/Propagation/LFMF/__init__.py +++ b/src/ITS/Propagation/LFMF/__init__.py @@ -2,4 +2,9 @@ # and Z is the version of this Python wrapper __version__ = "1.1.0" -from .LFMF import LFMF, Polarization, LFMFResult +from .LFMF import ( + LFMF, + Polarization, + SolutionMethod, + LFMFResult +) diff --git a/tests/test_lfmf.py b/tests/test_lfmf.py index db2d577..959dff4 100644 --- a/tests/test_lfmf.py +++ b/tests/test_lfmf.py @@ -10,12 +10,17 @@ read_csv_test_data("LFMF_Examples.csv"), ) def test_lfmf(inputs, rtn, expected): - if rtn == 0: - result = LFMF.LFMF(*inputs) - assert result.A_btl__db == pytest.approx(expected[0], abs=ABSTOL__DB) - assert result.E__dBuVm == pytest.approx(expected[1], abs=ABSTOL__DB) - assert result.P_rx__dbm == pytest.approx(expected[2], abs=ABSTOL__DB) - assert result.method == int(expected[3]) + if rtn != 40: + pol = LFMF.Polarization(int(inputs[-1])) + if rtn == 0: + result = LFMF.LFMF(*inputs[:-1], pol) + assert result.A_btl__db == pytest.approx(expected[0], abs=ABSTOL__DB) + assert result.E__dBuVm == pytest.approx(expected[1], abs=ABSTOL__DB) + assert result.P_rx__dbm == pytest.approx(expected[2], abs=ABSTOL__DB) + assert result.method == LFMF.SolutionMethod(int(expected[3])) + else: + with pytest.raises(RuntimeError): + LFMF.LFMF(*inputs[:-1], pol) else: - with pytest.raises(RuntimeError): - LFMF.LFMF(*inputs) + with pytest.raises(ValueError): + LFMF.LFMF(*inputs[:-1], LFMF.Polarization(int(inputs[-1]))) From 11d439d05d57d0c7fd74c36aab639bd15af867bb Mon Sep 17 00:00:00 2001 From: Chen Heroy Date: Thu, 22 May 2025 15:02:42 -0600 Subject: [PATCH 8/8] test invalid pol --- tests/test_lfmf.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/test_lfmf.py b/tests/test_lfmf.py index 959dff4..c420f49 100644 --- a/tests/test_lfmf.py +++ b/tests/test_lfmf.py @@ -22,5 +22,5 @@ def test_lfmf(inputs, rtn, expected): with pytest.raises(RuntimeError): LFMF.LFMF(*inputs[:-1], pol) else: - with pytest.raises(ValueError): - LFMF.LFMF(*inputs[:-1], LFMF.Polarization(int(inputs[-1]))) + with pytest.raises(RuntimeError): + LFMF.LFMF(*inputs[:-1], int(inputs[-1]))