Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
03172db
commit 1dc7ea8
Showing
3 changed files
with
97 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
name: Code testing | ||
|
||
on: [push, pull_request] | ||
|
||
jobs: | ||
Tests: | ||
|
||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
python-version: ['3.7', '3.8', '3.9', '3.10', '3.11', '3.12'] | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Set up Python ${{ matrix.python-version }} | ||
uses: actions/setup-python@v5 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
|
||
- name: Install dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install tox tox-gh-actions | ||
# run the tests located in skrf/ | ||
- name: Test the code, tutorials and examples | ||
if: ${{ always() }} | ||
run: | | ||
tox |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
# running 'tox' will run the tests located in west_ic_antenna/ | ||
# running 'tox -- --nbval-lax' will also run all the notebooks located in doc/ | ||
[tox] | ||
isolated_build = True | ||
envlist = py{37, 38, 39, 310, 311, 312} | ||
|
||
[gh-actions] | ||
python = | ||
3.7: py37 | ||
3.8: py38 | ||
3.9: py39 | ||
3.10: py310 | ||
3.11: py311 | ||
3.12: py312 | ||
|
||
# This is the default testsetup with all dependencies installed | ||
[testenv] | ||
deps = | ||
pytest | ||
commands = | ||
python -m pytest | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
# -*- coding: utf-8 -*- | ||
import pytest | ||
import skrf as rf | ||
import os | ||
|
||
from west_ic_antenna.antenna import ( | ||
WestIcrhAntenna, | ||
DEFAULT_FRONT_FACE, | ||
S_PARAMS_DIR, | ||
DEFAULT_BRIDGE, | ||
DEFAULT_IMPEDANCE_TRANSFORMER, | ||
DEFAULT_SERVICE_STUB, | ||
) | ||
|
||
# Useful definitions | ||
TEST_DIR = os.path.dirname(os.path.abspath(__file__)) | ||
DATA_DIR = os.path.join(TEST_DIR, '../data') | ||
|
||
@pytest.fixture | ||
def antenna_default_arg(): | ||
return WestIcrhAntenna() | ||
|
||
# Constructor Tests | ||
def test_constructor_default(antenna_default_arg): | ||
"""Test creation of Antenna instance""" | ||
assert isinstance(antenna_default_arg, WestIcrhAntenna) | ||
|
||
def test_setup_constructor_frequency(): | ||
freq = rf.Frequency(30, 60, npoints=10, unit='MHz') | ||
_ant = WestIcrhAntenna(frequency=freq) | ||
assert isinstance(_ant, WestIcrhAntenna) | ||
|
||
def test_setup_constructor_capa(): | ||
Cs = [20, 30, 40, 50] | ||
_ant = WestIcrhAntenna(Cs=Cs) | ||
assert isinstance(_ant, WestIcrhAntenna) | ||
|
||
def test_setup_constructor_frontface_filename(): | ||
_ant = WestIcrhAntenna(front_face=DEFAULT_FRONT_FACE) | ||
assert isinstance(_ant, WestIcrhAntenna) | ||
|
||
def test_setup_constructor_frontface_network(): | ||
ntw = rf.Network(DEFAULT_FRONT_FACE) | ||
_ant = WestIcrhAntenna(front_face=ntw) | ||
assert isinstance(_ant, WestIcrhAntenna) | ||
|