Skip to content

Commit 1762d99

Browse files
committed
test: add a pytest for get_part
1 parent e5984c7 commit 1762d99

File tree

2 files changed

+33
-0
lines changed

2 files changed

+33
-0
lines changed

Makefile

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
#!/usr/bin/make
2+
3+
check:
4+
pycodestyle openflow
5+
pylint -s n openflow
6+
git diff --check --cached
7+
pytest test
8+
9+
clean:
10+
py3clean .
11+
rm -fr .pytest_cache

test/test_part.py

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
import pytest
2+
3+
from openflow.openflow import get_part
4+
5+
6+
@pytest.mark.parametrize(
7+
'part, name, family, device, package', [
8+
('hx8k-ct256', 'hx8k-ct256', 'ice40', 'hx8k', 'ct256'),
9+
('HX8K-CT256', 'hx8k-ct256', 'ice40', 'hx8k', 'ct256'),
10+
('hx4k-tq144', 'hx4k-tq144', 'ice40', 'hx8k', 'tq144:4k'),
11+
('25k-CSFBGA285', '25k-csfbga285', 'ecp5', '25k', 'csfbga285'),
12+
('um5g-85k-CABGA381', 'um5g-85k-cabga381', 'ecp5', 'um5g-85k', 'cabga381')
13+
]
14+
)
15+
def test_part(part, name, family, device, package):
16+
result = get_part(part)
17+
print(result)
18+
assert result['name'] == name
19+
assert result['family'] == family
20+
assert result['device'] == device
21+
assert result['package'] == package
22+

0 commit comments

Comments
 (0)