"tests/git@developer.sourcefind.cn:OpenDAS/dgl.git" did not exist on "25217dc6242e67ea37de081cf5f81472730a57cb"
Unverified Commit aef00c4d authored by vfdev's avatar vfdev Committed by GitHub
Browse files

Fixed broken test_random_choice (#7315)

parent 74e33657
...@@ -1359,7 +1359,7 @@ class TestContainers: ...@@ -1359,7 +1359,7 @@ class TestContainers:
class TestRandomChoice: class TestRandomChoice:
def test_assertions(self): def test_assertions(self):
with pytest.raises(ValueError, match="The number of probabilities doesn't match the number of transforms"): with pytest.raises(ValueError, match="Length of p doesn't match the number of transforms"):
transforms.RandomChoice([transforms.Pad(2), transforms.RandomCrop(28)], p=[1]) transforms.RandomChoice([transforms.Pad(2), transforms.RandomCrop(28)], p=[1])
......
...@@ -822,7 +822,7 @@ class TestContainerTransforms: ...@@ -822,7 +822,7 @@ class TestContainerTransforms:
v2_transforms.Resize(256), v2_transforms.Resize(256),
legacy_transforms.CenterCrop(224), legacy_transforms.CenterCrop(224),
], ],
probabilities=probabilities, p=probabilities,
) )
legacy_transform = legacy_transforms.RandomChoice( legacy_transform = legacy_transforms.RandomChoice(
[ [
......
...@@ -139,7 +139,7 @@ class RandomChoice(Transform): ...@@ -139,7 +139,7 @@ class RandomChoice(Transform):
p = [1] * len(transforms) p = [1] * len(transforms)
elif len(p) != len(transforms): elif len(p) != len(transforms):
raise ValueError( raise ValueError(
f"The number of p doesn't match the number of transforms: " f"{len(p)} != {len(transforms)}" f"Length of p doesn't match the number of transforms: " f"{len(p)} != {len(transforms)}"
) )
super().__init__() super().__init__()
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment