Skip to content

Commit 51fe884

Browse files
[Fix] Fix doctest (#821)
* fix(test=document_fix) * pretty evaluation output with prettytable * fix code failed in doctest * Revert "Merge branch 'pretty_eval_output' into develop" This reverts commit 66cded1, reversing changes made to da865dd. * skip mesh example code in geometry/mesh.py for requiring pymesh installtion * skip more code for doctest
1 parent 7930348 commit 51fe884

File tree

19 files changed

+76
-63
lines changed

19 files changed

+76
-63
lines changed

ppsci/arch/amgnet.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -579,7 +579,9 @@ class AMGNet(nn.Layer):
579579
580580
Examples:
581581
>>> import ppsci
582-
>>> model = ppsci.arch.AMGNet(("input", ), ("pred", ), 5, 3, 64, 2)
582+
>>> model = ppsci.arch.AMGNet(
583+
... ("input", ), ("pred", ), 5, 3, 64, 2, "sum", 6, "norm",
584+
... )
583585
"""
584586

585587
def __init__(

ppsci/arch/chip_deeponets.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ class ChipDeepONets(base.Arch):
6060
6161
Examples:
6262
>>> import ppsci
63-
>>> model = ppsci.arch.ChipDeepONet(
63+
>>> model = ppsci.arch.ChipDeepONets(
6464
... ('u',),
6565
... ('bc',),
6666
... ('bc_data',),

ppsci/arch/epnn.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -65,12 +65,12 @@ class Epnn(base.Arch):
6565
6666
Examples:
6767
>>> import ppsci
68-
>>> ann_node_sizes_state = [1]
68+
>>> ann_node_sizes_state = [1, 20]
6969
>>> model = ppsci.arch.Epnn(
7070
... ("x",),
7171
... ("y",),
7272
... node_sizes=ann_node_sizes_state,
73-
... activations=("leaky_relu"),
73+
... activations=("leaky_relu",),
7474
... drop_p=0.0,
7575
... )
7676
"""
@@ -84,7 +84,9 @@ def __init__(
8484
drop_p: float,
8585
):
8686
super().__init__()
87-
self.active_func = [act_mod.get_activation(i) for i in activations]
87+
self.active_func = [
88+
act_mod.get_activation(act_name) for act_name in activations
89+
]
8890
self.node_sizes = node_sizes
8991
self.drop_p = drop_p
9092
self.layers = []

ppsci/arch/he_deeponets.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ class HEDeepONets(base.Arch):
5252
5353
Examples:
5454
>>> import ppsci
55-
>>> model = ppsci.arch.HEDeepONet(
55+
>>> model = ppsci.arch.HEDeepONets(
5656
... ('qm_h',),
5757
... ('qm_c',),
5858
... ("x",'t'),

ppsci/constraint/boundary_constraint.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ class BoundaryConstraint(base.Constraint):
6969
... },
7070
... ppsci.loss.MSELoss("mean"),
7171
... name="BC",
72-
... )
72+
... ) # doctest: +SKIP
7373
"""
7474

7575
def __init__(

ppsci/constraint/initial_constraint.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ class InitialConstraint(base.Constraint):
7474
... },
7575
... ppsci.loss.MSELoss("mean"),
7676
... name="IC",
77-
... )
77+
... ) # doctest: +SKIP
7878
"""
7979

8080
def __init__(

ppsci/constraint/integral_constraint.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ class IntegralConstraint(base.Constraint):
7171
... },
7272
... ppsci.loss.MSELoss("mean"),
7373
... name="IgC",
74-
... )
74+
... ) # doctest: +SKIP
7575
"""
7676

7777
def __init__(

ppsci/constraint/interior_constraint.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ class InteriorConstraint(base.Constraint):
7171
... },
7272
... ppsci.loss.MSELoss("mean"),
7373
... name="EQ",
74-
... )
74+
... ) # doctest: +SKIP
7575
"""
7676

7777
def __init__(

ppsci/data/dataset/era5_dataset.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -175,10 +175,10 @@ class ERA5SampledDataset(io.Dataset):
175175
... "label_keys": ("output",),
176176
... ) # doctest: +SKIP
177177
>>> # get the length of the dataset
178-
>>> dataset_size = len(dataset)
178+
>>> dataset_size = len(dataset) # doctest: +SKIP
179179
>>> # get the first sample of the data
180-
>>> first_sample = dataset[0]
181-
>>> print("First sample:", first_sample)
180+
>>> first_sample = dataset[0] # doctest: +SKIP
181+
>>> print("First sample:", first_sample) # doctest: +SKIP
182182
"""
183183

184184
def __init__(

ppsci/data/dataset/mrms_dataset.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -187,10 +187,10 @@ class MRMSSampledDataset(io.Dataset):
187187
... "num_total_timestamps": 29,
188188
... ) # doctest: +SKIP
189189
>>> # get the length of the dataset
190-
>>> dataset_size = len(dataset)
190+
>>> dataset_size = len(dataset) # doctest: +SKIP
191191
>>> # get the first sample of the data
192-
>>> first_sample = dataset[0]
193-
>>> print("First sample:", first_sample)
192+
>>> first_sample = dataset[0] # doctest: +SKIP
193+
>>> print("First sample:", first_sample) # doctest: +SKIP
194194
"""
195195

196196
def __init__(

0 commit comments

Comments
 (0)