From 5dc8c803baeea8a9105bcf4d83ca1337f567b79b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Francisco=20Mu=C3=B1oz?= Date: Tue, 7 May 2024 18:41:31 -0400 Subject: [PATCH] debug: change time sleep to 1 for testing --- library/logging_.py | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/library/logging_.py b/library/logging_.py index 0d72f42..e7d7775 100644 --- a/library/logging_.py +++ b/library/logging_.py @@ -805,9 +805,9 @@ class register_total_time: elapsed time with the attribute ``elapsed_time``. >>> with register_total_time(log) as timer: - ... time.sleep(0.2) - >>> round(timer.elapsed_time, 1) - 0.2 + ... time.sleep(1) + >>> round(timer.elapsed_time) + 1 >>> print(log_stream.getvalue()[:-6]) # Remove the microseconds Starting the block of code... The block of code takes 0:00:00.2 @@ -818,10 +818,10 @@ class register_total_time: >>> @register_total_time(log) ... def test_function(): - ... time.sleep(0.2) + ... time.sleep(1) >>> test_function() - >>> print(log_stream.getvalue()[:-6]) # Remove the microseconds - The function 'test_function' takes 0:00:00.2 + >>> print(log_stream.getvalue()[:-8]) # Remove the microseconds + The function 'test_function' takes 0:00:01 And even set the level of the logger. @@ -830,7 +830,7 @@ class register_total_time: >>> log2.addHandler(logging.StreamHandler(log_stream2)) >>> @register_total_time(log2, logging.INFO) # This will not show ... def test_function(): - ... time.sleep(0.2) + ... time.sleep(0.1) >>> test_function() >>> log_stream2.getvalue() # Nothing to show '' @@ -915,10 +915,10 @@ def register_total_time_function( >>> @register_total_time_function(log) ... def test_function(): - ... time.sleep(0.2) + ... time.sleep(1) >>> test_function() - >>> print(log_stream.getvalue()[:-6]) # Remove the microseconds - The function 'test_function' takes 0:00:00.2 + >>> print(log_stream.getvalue()[:-8]) # Remove the microseconds + The function 'test_function' takes 0:00:01 """ # noinspection PyMissingOrEmptyDocstring @@ -967,11 +967,11 @@ def register_total_time_method( >>> class Test: ... @register_total_time_method(log) ... def test_method(self): - ... time.sleep(0.2) + ... time.sleep(1) >>> Test().test_method() - >>> print(log_stream.getvalue()[:-6]) # Remove the microseconds + >>> print(log_stream.getvalue()[:-8]) # Remove the microseconds Using the method 'Test.test_method'... - The method 'Test.test_method' takes 0:00:00.2 + The method 'Test.test_method' takes 0:00:01 """ # noinspection PyMissingOrEmptyDocstring