Dev Update (#582)
* Fix adaptive refinement (#571) --------- Co-authored-by: Dario Coscia <93731561+dario-coscia@users.noreply.github.com> * Remove collector * Fixes * Fixes * rm unnecessary comment * fix advection (#581) * Fix tutorial .html link (#580) * fix problem data collection for v0.1 (#584) * Message Passing Module (#516) * add deep tensor network block * add interaction network block * add radial field network block * add schnet block * add equivariant network block * fix + tests + doc files * fix egnn + equivariance/invariance tests Co-authored-by: Dario Coscia <dariocos99@gmail.com> --------- Co-authored-by: giovanni <giovanni.canali98@yahoo.it> Co-authored-by: AleDinve <giuseppealessio.d@student.unisi.it> * add type checker (#527) --------- Co-authored-by: Filippo Olivo <filippo@filippoolivo.com> Co-authored-by: Giovanni Canali <115086358+GiovanniCanali@users.noreply.github.com> Co-authored-by: giovanni <giovanni.canali98@yahoo.it> Co-authored-by: AleDinve <giuseppealessio.d@student.unisi.it>
This commit is contained in:
@@ -1,12 +1,9 @@
|
||||
import torch
|
||||
|
||||
from pina.utils import merge_tensors
|
||||
from pina.label_tensor import LabelTensor
|
||||
from pina import LabelTensor
|
||||
from pina.domain import EllipsoidDomain, CartesianDomain
|
||||
from pina.utils import check_consistency
|
||||
import pytest
|
||||
from pina.domain import DomainInterface
|
||||
|
||||
from pina import LabelTensor
|
||||
from pina.utils import merge_tensors, check_consistency, check_positive_integer
|
||||
from pina.domain import EllipsoidDomain, CartesianDomain, DomainInterface
|
||||
|
||||
|
||||
def test_merge_tensors():
|
||||
@@ -50,3 +47,24 @@ def test_check_consistency_incorrect():
|
||||
check_consistency(torch.Tensor, DomainInterface, subclass=True)
|
||||
with pytest.raises(ValueError):
|
||||
check_consistency(ellipsoid1, torch.Tensor)
|
||||
|
||||
|
||||
@pytest.mark.parametrize("value", [0, 1, 2, 3, 10])
|
||||
@pytest.mark.parametrize("strict", [True, False])
|
||||
def test_check_positive_integer(value, strict):
|
||||
if value != 0:
|
||||
check_positive_integer(value, strict=strict)
|
||||
else:
|
||||
check_positive_integer(value, strict=False)
|
||||
|
||||
# Should fail if value is negative
|
||||
with pytest.raises(AssertionError):
|
||||
check_positive_integer(-1, strict=strict)
|
||||
|
||||
# Should fail if value is not an integer
|
||||
with pytest.raises(AssertionError):
|
||||
check_positive_integer(1.5, strict=strict)
|
||||
|
||||
# Should fail if value is not a number
|
||||
with pytest.raises(AssertionError):
|
||||
check_positive_integer("string", strict=strict)
|
||||
|
||||
Reference in New Issue
Block a user