Best Python code snippet using hypothesis
datetime.py
Source:datetime.py
...367 # For details see https://github.com/HypothesisWorks/hypothesis/issues/2414368 strategy = sampled_from([key for key in available_timezones if valid_key(key)])369 if not allow_prefix:370 return strategy371 def sample_with_prefixes(zone):372 keys_with_prefixes = (zone, f"posix/{zone}", f"right/{zone}")373 return sampled_from([key for key in keys_with_prefixes if valid_key(key)])374 return strategy.flatmap(sample_with_prefixes)375@defines_strategy(force_reusable_values=True)376def timezones(*, no_cache: bool = False) -> SearchStrategy["zoneinfo.ZoneInfo"]:377 """A strategy for :class:`python:zoneinfo.ZoneInfo` objects.378 If ``no_cache=True``, the generated instances are constructed using379 :meth:`ZoneInfo.no_cache <python:zoneinfo.ZoneInfo.no_cache>` instead380 of the usual constructor. This may change the semantics of your datetimes381 in surprising ways, so only use it if you know that you need to!382 .. note::383 The :mod:`python:zoneinfo` module is new in Python 3.9, so you will need384 to install the :pypi:`backports.zoneinfo` module on earlier versions, and385 the :pypi:`importlib_resources` backport on Python 3.6....
Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!