python-telegram-bot/telegram/ext
Andrej730 110e2df443
Job.next_t (#1685)
* next_t property is added to Job class

Added new property to Job class - next_t, it will show the datetime when the job will be executed next time.
The property is updated during JobQueue._put method, right after job is added to queue.
Related to #1676

* Fixed newline and trailing whitespace

* Fixed PR issues, added test

1. Added setter for next_t - now JobQueue doesn't access protected Job._next_t.
2. Fixed Job class docstring.
3. Added test for next_t property.
4. Set next_t to None for run_once jobs that already ran.

* Fixed Flake8 issues

* Added next_t setter for datetime, added test

1. next_t setter now can accept datetime type.
2. added test for setting datetime to next_t and added some asserts that check tests results.
3. Also noticed Job.days setter raises ValueError when it's more appropriate to raise TypeError.

* Fixed test_warnings, added Number type to next_t setter

1. Changed type of error raised by interval setter from ValueError to TypeError..
2. Fixed test_warning after changing type of errors in Job.days and Job.interval.
3. Added Number type to next_t setter - now it can accept int too.

* Python 2 compatibility for test_job_next_t_property

Added _UTC and _UtcOffsetTimezone for python 2 compatibility

* Fixed PR issues

1. Replaced "datetime.replace tzinfo" with "datetime.astimezone"
2. Moved testing next_t setter to separate test.
3. Changed test_job_next_t_setter so it now uses non UTC timezone.

* Defining tzinfo from run_once, run_repeating

1. Added option to define Job.tzinfo from run_once (by when.tzinfo) and run_repeating (first.tzinfo)
2. Added test to check that tzinfo is always passed correctly.

* address review

Co-authored-by: Hinrich Mahler <hinrich.mahler@freenet.de>
2020-04-18 15:08:16 +02:00
..
__init__.py API 4.6 (#1723) 2020-03-29 09:52:30 +02:00
basepersistence.py bot_data as global memory (V12 version of #1322) (#1325) 2020-02-02 22:20:31 +01:00
callbackcontext.py bot_data as global memory (V12 version of #1322) (#1325) 2020-02-02 22:20:31 +01:00
callbackqueryhandler.py Update copyright date to 2020 (#1746) 2020-02-02 23:08:54 +02:00
choseninlineresulthandler.py Update copyright date to 2020 (#1746) 2020-02-02 23:08:54 +02:00
commandhandler.py PrefixHandlers command and prefix editable (#1636) 2020-03-30 17:49:50 +02:00
conversationhandler.py Pass last valid context to TIMEOUT handlers (#1826) 2020-04-10 13:18:43 +02:00
defaults.py Add default values (#1490) 2020-02-06 11:22:56 +01:00
dictpersistence.py Tweak persistence handling (#1827) 2020-04-10 13:23:13 +02:00
dispatcher.py Doc Fixes 2020-04-10 23:43:58 +02:00
filters.py Notes on Filters.text accepting command messages (#1902) 2020-04-18 12:16:14 +02:00
handler.py Update copyright date to 2020 (#1746) 2020-02-02 23:08:54 +02:00
inlinequeryhandler.py Update copyright date to 2020 (#1746) 2020-02-02 23:08:54 +02:00
jobqueue.py Job.next_t (#1685) 2020-04-18 15:08:16 +02:00
messagehandler.py Update copyright date to 2020 (#1746) 2020-02-02 23:08:54 +02:00
messagequeue.py Update copyright date to 2020 (#1746) 2020-02-02 23:08:54 +02:00
picklepersistence.py Tweak persistence handling (#1827) 2020-04-10 13:23:13 +02:00
pollanswerhandler.py API 4.6 (#1723) 2020-03-29 09:52:30 +02:00
pollhandler.py API 4.6 (#1723) 2020-03-29 09:52:30 +02:00
precheckoutqueryhandler.py Update copyright date to 2020 (#1746) 2020-02-02 23:08:54 +02:00
regexhandler.py Update copyright date to 2020 (#1746) 2020-02-02 23:08:54 +02:00
shippingqueryhandler.py Update copyright date to 2020 (#1746) 2020-02-02 23:08:54 +02:00
stringcommandhandler.py Update copyright date to 2020 (#1746) 2020-02-02 23:08:54 +02:00
stringregexhandler.py Update copyright date to 2020 (#1746) 2020-02-02 23:08:54 +02:00
typehandler.py Update copyright date to 2020 (#1746) 2020-02-02 23:08:54 +02:00
updater.py Favor concrete types over "Iterable" (#1882) 2020-04-08 22:49:01 +02:00