Skip to content

Commit

Permalink
fix test
Browse files Browse the repository at this point in the history
  • Loading branch information
juanitorduz committed Dec 20, 2024
1 parent 32df593 commit d29507a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
4 changes: 2 additions & 2 deletions numpyro/distributions/distribution.py
Original file line number Diff line number Diff line change
Expand Up @@ -572,8 +572,8 @@ class DistributionLike(Protocol):
or tensorflow_probability.distributions.Distribution.
"""

def __call__(self, *args: Any, **kwds: Any) -> Any:
return super().__call__(*args, **kwds)
def __call__(self, *args: Any, **kwargs: Any) -> Any:
return super().__call__(*args, **kwargs)

@property
def batch_shape(self) -> tuple[int, ...]: ...
Expand Down
7 changes: 5 additions & 2 deletions test/test_distributions.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
# Copyright Contributors to the Pyro project.
# SPDX-License-Identifier: Apache-2.0

from collections import namedtuple
from functools import partial
import inspect
from itertools import product
import math
import os
from typing import Callable
from typing import Any, Callable

import numpy as np
from numpy.testing import assert_allclose, assert_array_equal
Expand Down Expand Up @@ -3540,6 +3539,9 @@ def make_dist():

# Test class that properly implements DistributionLike
class ValidDistributionLike:
def __call__(self, *args: Any, **kwargs: Any) -> Any:
return ()

@property
def batch_shape(self) -> tuple[int, ...]:
return ()
Expand Down Expand Up @@ -3600,6 +3602,7 @@ def test_distribution_like_interface():
my_dist = ValidDistributionLike()

# Test basic properties
assert my_dist() == ()
assert my_dist.batch_shape == ()
assert my_dist.event_shape == ()
assert my_dist.event_dim == 0
Expand Down

0 comments on commit d29507a

Please sign in to comment.