Skip to content

Commit f18687f

Browse files
committed
tests
1 parent 3f841d5 commit f18687f

File tree

1 file changed

+14
-11
lines changed

1 file changed

+14
-11
lines changed

tests/pipelines/test_pipelines.py

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1811,31 +1811,34 @@ def test_wrong_model(self):
18111811
"hf-internal-testing/diffusers-stable-diffusion-tiny-all", text_encoder=tokenizer
18121812
)
18131813

1814-
assert "Expected" in str(error_context.exception)
1815-
assert "text_encoder" in str(error_context.exception)
1816-
assert "CLIPTokenizer" in str(error_context.exception)
1814+
assert "is of type" in str(error_context.exception)
1815+
assert "but should be" in str(error_context.exception)
18171816

18181817
def test_wrong_model_scheduler_type(self):
18191818
scheduler = EulerDiscreteScheduler.from_pretrained("hf-internal-testing/tiny-flux-pipe", subfolder="scheduler")
1820-
with self.assertRaises(ValueError) as error_context:
1819+
with self.assertLogs(
1820+
logging.get_logger("diffusers.pipelines.pipeline_utils"), level="WARNING"
1821+
) as warning_context:
18211822
_ = FluxPipeline.from_pretrained("hf-internal-testing/tiny-flux-pipe", scheduler=scheduler)
18221823

1823-
assert "Expected" in str(error_context.exception)
1824-
assert "scheduler" in str(error_context.exception)
1825-
assert "EulerDiscreteScheduler" in str(error_context.exception)
1824+
assert any("Expected" in message for message in warning_context.output)
1825+
assert any("scheduler" in message for message in warning_context.output)
1826+
assert any("EulerDiscreteScheduler" in message for message in warning_context.output)
18261827

18271828
def test_wrong_model_scheduler_enum(self):
18281829
scheduler = FlowMatchEulerDiscreteScheduler.from_pretrained(
18291830
"hf-internal-testing/diffusers-stable-diffusion-tiny-all", subfolder="scheduler"
18301831
)
1831-
with self.assertRaises(ValueError) as error_context:
1832+
with self.assertLogs(
1833+
logging.get_logger("diffusers.pipelines.pipeline_utils"), level="WARNING"
1834+
) as warning_context:
18321835
_ = StableDiffusionPipeline.from_pretrained(
18331836
"hf-internal-testing/diffusers-stable-diffusion-tiny-all", scheduler=scheduler
18341837
)
18351838

1836-
assert "Expected" in str(error_context.exception)
1837-
assert "scheduler" in str(error_context.exception)
1838-
assert "FlowMatchEulerDiscreteScheduler" in str(error_context.exception)
1839+
assert any("Expected" in message for message in warning_context.output)
1840+
assert any("scheduler" in message for message in warning_context.output)
1841+
assert any("FlowMatchEulerDiscreteScheduler" in message for message in warning_context.output)
18391842

18401843

18411844
@slow

0 commit comments

Comments
 (0)