From 6a61cf811655fa87dbcb196025cc0b6040502293 Mon Sep 17 00:00:00 2001 From: Heiner Lohaus Date: Wed, 4 Oct 2023 07:20:51 +0200 Subject: Sort providers in new dirs --- testing/test_providers.py | 20 ++++---------------- 1 file changed, 4 insertions(+), 16 deletions(-) (limited to 'testing') diff --git a/testing/test_providers.py b/testing/test_providers.py index 73b75f5d..462f19bc 100644 --- a/testing/test_providers.py +++ b/testing/test_providers.py @@ -33,22 +33,10 @@ def main(): def get_providers() -> list[type[BaseProvider]]: - provider_names = dir(Provider) - ignore_names = [ - "annotations", - "helper", - "base_provider", - "retry_provider", - "BaseProvider", - "AsyncProvider", - "AsyncGeneratorProvider", - "RetryProvider", - ] - return [ - getattr(Provider, provider_name) - for provider_name in provider_names - if not provider_name.startswith("__") and provider_name not in ignore_names - ] + providers = dir(Provider) + providers = [getattr(Provider, provider) for provider in providers if provider != "RetryProvider"] + providers = [provider for provider in providers if isinstance(provider, type)] + return [provider for provider in providers if issubclass(provider, BaseProvider)] def create_response(_provider: type[BaseProvider]) -> str: -- cgit v1.2.3