Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
OpenDAS
dgl
Commits
b0b78928
Unverified
Commit
b0b78928
authored
Dec 20, 2023
by
Mingbang Wang
Committed by
GitHub
Dec 20, 2023
Browse files
[Test] add assertion message for testcases in `test/examples` (#6778)
parent
67cd09d7
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
39 additions
and
13 deletions
+39
-13
tests/examples/test_sampling_examples.py
tests/examples/test_sampling_examples.py
+6
-2
tests/examples/test_sparse_examples.py
tests/examples/test_sparse_examples.py
+33
-11
No files found.
tests/examples/test_sampling_examples.py
View file @
b0b78928
...
...
@@ -17,7 +17,9 @@ EXAMPLE_ROOT = os.path.join(
def
test_node_classification
():
script
=
os
.
path
.
join
(
EXAMPLE_ROOT
,
"node_classification.py"
)
out
=
subprocess
.
run
([
"python"
,
str
(
script
)],
capture_output
=
True
)
assert
out
.
returncode
==
0
assert
(
out
.
returncode
==
0
),
f
"stdout:
{
out
.
stdout
.
decode
(
'utf-8'
)
}
\n
stderr:
{
out
.
stderr
.
decode
(
'utf-8'
)
}
"
stdout
=
out
.
stdout
.
decode
(
"utf-8"
)
assert
float
(
stdout
[
-
5
:])
>
0.60
...
...
@@ -26,6 +28,8 @@ def test_node_classification():
def
test_link_prediction
():
script
=
os
.
path
.
join
(
EXAMPLE_ROOT
,
"link_prediction.py"
)
out
=
subprocess
.
run
([
"python"
,
str
(
script
)],
capture_output
=
True
)
assert
out
.
returncode
==
0
assert
(
out
.
returncode
==
0
),
f
"stdout:
{
out
.
stdout
.
decode
(
'utf-8'
)
}
\n
stderr:
{
out
.
stderr
.
decode
(
'utf-8'
)
}
"
stdout
=
out
.
stdout
.
decode
(
"utf-8"
)
assert
float
(
stdout
[
-
5
:])
>
0.80
tests/examples/test_sparse_examples.py
View file @
b0b78928
...
...
@@ -14,7 +14,9 @@ EXAMPLE_ROOT = os.path.join(
def
test_gcn
():
script
=
os
.
path
.
join
(
EXAMPLE_ROOT
,
"gcn.py"
)
out
=
subprocess
.
run
([
"python"
,
str
(
script
)],
capture_output
=
True
)
assert
out
.
returncode
==
0
assert
(
out
.
returncode
==
0
),
f
"stdout:
{
out
.
stdout
.
decode
(
'utf-8'
)
}
\n
stderr:
{
out
.
stderr
.
decode
(
'utf-8'
)
}
"
stdout
=
out
.
stdout
.
decode
(
"utf-8"
)
assert
float
(
stdout
[
-
5
:])
>
0.75
...
...
@@ -22,7 +24,9 @@ def test_gcn():
def
test_gcnii
():
script
=
os
.
path
.
join
(
EXAMPLE_ROOT
,
"gcnii.py"
)
out
=
subprocess
.
run
([
"python"
,
str
(
script
)],
capture_output
=
True
)
assert
out
.
returncode
==
0
assert
(
out
.
returncode
==
0
),
f
"stdout:
{
out
.
stdout
.
decode
(
'utf-8'
)
}
\n
stderr:
{
out
.
stderr
.
decode
(
'utf-8'
)
}
"
stdout
=
out
.
stdout
.
decode
(
"utf-8"
)
assert
float
(
stdout
[
-
5
:])
>
0.75
...
...
@@ -30,7 +34,9 @@ def test_gcnii():
def
test_appnp
():
script
=
os
.
path
.
join
(
EXAMPLE_ROOT
,
"appnp.py"
)
out
=
subprocess
.
run
([
"python"
,
str
(
script
)],
capture_output
=
True
)
assert
out
.
returncode
==
0
assert
(
out
.
returncode
==
0
),
f
"stdout:
{
out
.
stdout
.
decode
(
'utf-8'
)
}
\n
stderr:
{
out
.
stderr
.
decode
(
'utf-8'
)
}
"
stdout
=
out
.
stdout
.
decode
(
"utf-8"
)
assert
float
(
stdout
[
-
5
:])
>
0.75
...
...
@@ -38,7 +44,9 @@ def test_appnp():
def
test_c_and_s
():
script
=
os
.
path
.
join
(
EXAMPLE_ROOT
,
"c_and_s.py"
)
out
=
subprocess
.
run
([
"python"
,
str
(
script
)],
capture_output
=
True
)
assert
out
.
returncode
==
0
assert
(
out
.
returncode
==
0
),
f
"stdout:
{
out
.
stdout
.
decode
(
'utf-8'
)
}
\n
stderr:
{
out
.
stderr
.
decode
(
'utf-8'
)
}
"
stdout
=
out
.
stdout
.
decode
(
"utf-8"
)
assert
float
(
stdout
[
-
5
:])
>
0.7
...
...
@@ -46,7 +54,9 @@ def test_c_and_s():
def
test_gat
():
script
=
os
.
path
.
join
(
EXAMPLE_ROOT
,
"gat.py"
)
out
=
subprocess
.
run
([
"python"
,
str
(
script
)],
capture_output
=
True
)
assert
out
.
returncode
==
0
assert
(
out
.
returncode
==
0
),
f
"stdout:
{
out
.
stdout
.
decode
(
'utf-8'
)
}
\n
stderr:
{
out
.
stderr
.
decode
(
'utf-8'
)
}
"
stdout
=
out
.
stdout
.
decode
(
"utf-8"
)
assert
float
(
stdout
[
-
5
:])
>
0.7
...
...
@@ -54,7 +64,9 @@ def test_gat():
def
test_hgnn
():
script
=
os
.
path
.
join
(
EXAMPLE_ROOT
,
"hgnn.py"
)
out
=
subprocess
.
run
([
"python"
,
str
(
script
)],
capture_output
=
True
)
assert
out
.
returncode
==
0
assert
(
out
.
returncode
==
0
),
f
"stdout:
{
out
.
stdout
.
decode
(
'utf-8'
)
}
\n
stderr:
{
out
.
stderr
.
decode
(
'utf-8'
)
}
"
stdout
=
out
.
stdout
.
decode
(
"utf-8"
)
assert
float
(
stdout
[
-
5
:])
>
0.66
...
...
@@ -64,13 +76,17 @@ def test_hypergraphatt():
out
=
subprocess
.
run
(
[
"python"
,
str
(
script
),
"--epochs=10"
],
capture_output
=
True
)
assert
out
.
returncode
==
0
assert
(
out
.
returncode
==
0
),
f
"stdout:
{
out
.
stdout
.
decode
(
'utf-8'
)
}
\n
stderr:
{
out
.
stderr
.
decode
(
'utf-8'
)
}
"
def
test_sgc
():
script
=
os
.
path
.
join
(
EXAMPLE_ROOT
,
"sgc.py"
)
out
=
subprocess
.
run
([
"python"
,
str
(
script
)],
capture_output
=
True
)
assert
out
.
returncode
==
0
assert
(
out
.
returncode
==
0
),
f
"stdout:
{
out
.
stdout
.
decode
(
'utf-8'
)
}
\n
stderr:
{
out
.
stderr
.
decode
(
'utf-8'
)
}
"
stdout
=
out
.
stdout
.
decode
(
"utf-8"
)
assert
float
(
stdout
[
-
5
:])
>
0.7
...
...
@@ -78,7 +94,9 @@ def test_sgc():
def
test_sign
():
script
=
os
.
path
.
join
(
EXAMPLE_ROOT
,
"sign.py"
)
out
=
subprocess
.
run
([
"python"
,
str
(
script
)],
capture_output
=
True
)
assert
out
.
returncode
==
0
assert
(
out
.
returncode
==
0
),
f
"stdout:
{
out
.
stdout
.
decode
(
'utf-8'
)
}
\n
stderr:
{
out
.
stderr
.
decode
(
'utf-8'
)
}
"
stdout
=
out
.
stdout
.
decode
(
"utf-8"
)
assert
float
(
stdout
[
-
5
:])
>
0.7
...
...
@@ -87,13 +105,17 @@ def test_twirls():
script
=
os
.
path
.
join
(
EXAMPLE_ROOT
,
"twirls.py"
)
out
=
subprocess
.
run
([
"python"
,
str
(
script
)],
capture_output
=
True
)
assert
out
.
returncode
==
0
assert
(
out
.
returncode
==
0
),
f
"stdout:
{
out
.
stdout
.
decode
(
'utf-8'
)
}
\n
stderr:
{
out
.
stderr
.
decode
(
'utf-8'
)
}
"
stdout
=
out
.
stdout
.
decode
(
"utf-8"
)
assert
float
(
stdout
[
-
5
:])
>
0.7
out
=
subprocess
.
run
(
[
"python"
,
str
(
script
),
"--attention"
],
capture_output
=
True
)
assert
out
.
returncode
==
0
assert
(
out
.
returncode
==
0
),
f
"stdout:
{
out
.
stdout
.
decode
(
'utf-8'
)
}
\n
stderr:
{
out
.
stderr
.
decode
(
'utf-8'
)
}
"
stdout
=
out
.
stdout
.
decode
(
"utf-8"
)
assert
float
(
stdout
[
-
5
:])
>
0.65
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment