From 7a159f7ff1c74ac4143f08da86b098be35acf12f Mon Sep 17 00:00:00 2001 From: Matthias Jobst Date: Wed, 5 Jul 2023 18:57:43 +0200 Subject: [PATCH 1/3] added input/output node tests --- nir/test/test_ir.py | 8 ++++++++ nir/test/test_readwrite.py | 7 +++++++ 2 files changed, 15 insertions(+) diff --git a/nir/test/test_ir.py b/nir/test/test_ir.py index fdee753..6822111 100644 --- a/nir/test/test_ir.py +++ b/nir/test/test_ir.py @@ -6,3 +6,11 @@ def test_simple(): assert ir.nodes[0].weights == [1, 2, 3] assert ir.nodes[0].bias == 4 assert ir.edges == [(0, 0)] + +def test_simple_with_input_output(): + ir = nir.NIR(nodes=[nir.Input(shape=[3,]), nir.Linear(weights=[1, 2, 3], bias=4), nir.Output()], edges=[(0, 1), (1,2)]) + assert ir.nodes[0].shape == [3,] + assert ir.nodes[1].weights == [1, 2, 3] + assert ir.nodes[1].bias == 4 + assert ir.edges == [(0, 1), (1, 2)] + diff --git a/nir/test/test_readwrite.py b/nir/test/test_readwrite.py index f2aab74..86d5bf9 100644 --- a/nir/test/test_readwrite.py +++ b/nir/test/test_readwrite.py @@ -36,3 +36,10 @@ def test_leaky_integrator_and_fire(): edges=[(0, 0)], ) factory_test_graph(ir) + +def test_simple_with_read_write(): + ir = nir.NIR( + nodes=[nir.Input(shape=[3,]), nir.Linear(weights=[1, 2, 3], bias=4), nir.Output()], + edges=[(0, 1), (1,2)] + ) + factory_test_graph(ir) From 3fc1f4913603bb42d90fed42c1089ef85f16a298 Mon Sep 17 00:00:00 2001 From: Matthias Jobst Date: Wed, 5 Jul 2023 19:48:28 +0200 Subject: [PATCH 2/3] fixed line length in tests --- nir/test/test_ir.py | 7 ++++++- nir/test/test_readwrite.py | 4 +++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/nir/test/test_ir.py b/nir/test/test_ir.py index 6822111..a1080c5 100644 --- a/nir/test/test_ir.py +++ b/nir/test/test_ir.py @@ -8,7 +8,12 @@ def test_simple(): assert ir.edges == [(0, 0)] def test_simple_with_input_output(): - ir = nir.NIR(nodes=[nir.Input(shape=[3,]), nir.Linear(weights=[1, 2, 3], bias=4), nir.Output()], edges=[(0, 1), (1,2)]) + ir = nir.NIR( + nodes=[ + nir.Input(shape=[3,]), + nir.Linear(weights=[1, 2, 3], bias=4), + nir.Output()], + edges=[(0, 1), (1,2)]) assert ir.nodes[0].shape == [3,] assert ir.nodes[1].weights == [1, 2, 3] assert ir.nodes[1].bias == 4 diff --git a/nir/test/test_readwrite.py b/nir/test/test_readwrite.py index 86d5bf9..1601664 100644 --- a/nir/test/test_readwrite.py +++ b/nir/test/test_readwrite.py @@ -39,7 +39,9 @@ def test_leaky_integrator_and_fire(): def test_simple_with_read_write(): ir = nir.NIR( - nodes=[nir.Input(shape=[3,]), nir.Linear(weights=[1, 2, 3], bias=4), nir.Output()], + nodes=[nir.Input(shape=[3,]), + nir.Linear(weights=[1, 2, 3], bias=4), + nir.Output()], edges=[(0, 1), (1,2)] ) factory_test_graph(ir) From 65ed1990f8191172cfb300520d96f0204c75dd7c Mon Sep 17 00:00:00 2001 From: Matthias Jobst Date: Wed, 5 Jul 2023 19:49:22 +0200 Subject: [PATCH 3/3] exclude docs/ from lint checking --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index dd9e47e..a9cb1b3 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -30,7 +30,7 @@ jobs: # stop the build if there are Python syntax errors or undefined names ruff --format=github --select=E9,F63,F7,F82 --target-version=py37 . # default set of ruff rules with GitHub Annotations - ruff --format=github --target-version=py37 . + ruff --format=github --target-version=py37 --exclude=docs/ . - name: Test with pytest run: | pytest \ No newline at end of file