diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 82c66a3..82d31e5 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -1,24 +1,19 @@ # This workflow will install Python dependencies, run tests and lint with a single version of Python # For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python -name: Python application - +name: Build and test on: push: branches: [ "main", "dev-json" ] pull_request: branches: [ "main" ] merge_group: - -permissions: - contents: read - jobs: build: runs-on: ubuntu-latest strategy: matrix: - python-version: ["3.8", "3.9", "3.10", "3.11"] + python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"] steps: - uses: actions/checkout@v4 - name: Setup Python @@ -29,7 +24,9 @@ jobs: run: | python -m pip install --upgrade pip pip install pytest - python -m install + - name: install xDEVS + run: | + python -m pip install . - name: Test with pytest run: | pytest diff --git a/xdevs/models.py b/xdevs/models.py index 692cbaa..b859e56 100644 --- a/xdevs/models.py +++ b/xdevs/models.py @@ -29,7 +29,8 @@ def __len__(self) -> int: return sum((len(port) for port in self._bag), len(self._values)) def __str__(self) -> str: - return f'{self.name}<{self.p_type.__name__ if self.p_type is not None else 'None'}>' + p_type = self.p_type.__name__ if self.p_type is not None else 'None' + return f'{self.name}<{p_type}>' def __repr__(self) -> str: return str(self) diff --git a/xdevs/plugins/input_handlers/bad_dependencies.py b/xdevs/plugins/input_handlers/bad_dependencies.py index 6c864c3..bfcee17 100644 --- a/xdevs/plugins/input_handlers/bad_dependencies.py +++ b/xdevs/plugins/input_handlers/bad_dependencies.py @@ -9,7 +9,8 @@ def __init__(self, **kwargs): :param str handler_type: transducer type. """ super().__init__(**kwargs) - raise ImportError(f'{kwargs.get('handler_type')} input handler specific dependencies are not imported') + handler_type = kwargs['handler_type'] + raise ImportError(f'{handler_type} input handler specific dependencies are not imported') def run(self): pass diff --git a/xdevs/plugins/output_handlers/bad_dependencies.py b/xdevs/plugins/output_handlers/bad_dependencies.py index b1fe605..2b3ea18 100644 --- a/xdevs/plugins/output_handlers/bad_dependencies.py +++ b/xdevs/plugins/output_handlers/bad_dependencies.py @@ -9,7 +9,8 @@ def __init__(self, **kwargs): :param str handler_type: transducer type. """ super().__init__(**kwargs) - raise ImportError(f'{kwargs['handler_type']} input handler specific dependencies are not imported') + handler_type = kwargs['handler_type'] + raise ImportError(f'{handler_type} input handler specific dependencies are not imported') def run(self): pass diff --git a/xdevs/plugins/transducers/bad_dependencies.py b/xdevs/plugins/transducers/bad_dependencies.py index d03cbf2..a76943d 100644 --- a/xdevs/plugins/transducers/bad_dependencies.py +++ b/xdevs/plugins/transducers/bad_dependencies.py @@ -9,7 +9,8 @@ def __init__(self, **kwargs): :param str transducer_type: transducer type. """ super().__init__(**kwargs) - raise ImportError(f'{kwargs.get('transducer_type')} transducer specific dependencies are not imported') + transducer_type = kwargs['transducer_type'] + raise ImportError(f'{transducer_type} transducer specific dependencies are not imported') def create_known_data_types_map(self): pass diff --git a/xdevs/plugins/wrappers/bad_dependencies.py b/xdevs/plugins/wrappers/bad_dependencies.py index d37c58e..858e410 100644 --- a/xdevs/plugins/wrappers/bad_dependencies.py +++ b/xdevs/plugins/wrappers/bad_dependencies.py @@ -9,7 +9,8 @@ def __init__(self, **kwargs): :param str wrapper_type: wrapper type. """ super().__init__(**kwargs) - raise ImportError(f'{kwargs['wrapper_type']} wrapper specific dependencies are not installed') + wrapper_type = kwargs['wrapper_type'] + raise ImportError(f'{wrapper_type} wrapper specific dependencies are not installed') def deltint(self): pass