本文整理匯總了Python中validation.Validate.validate_date方法的典型用法代碼示例。如果您正苦於以下問題:Python Validate.validate_date方法的具體用法?Python Validate.validate_date怎麽用?Python Validate.validate_date使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類validation.Validate
的用法示例。
在下文中一共展示了Validate.validate_date方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: add_new_donation_event
# 需要導入模塊: from validation import Validate [as 別名]
# 或者: from validation.Validate import validate_date [as 別名]
def add_new_donation_event(cursor_object):
print("Adding new event...\n")
time.sleep(1)
clear()
e1 = Event()
while True:
e1.date_of_event = input("Date of Event: ")
if Validate.validate_date(e1.date_of_event) and e1.registration_in_tendays():
pass
else:
print("\n\t ! The registration should be at least 10 days from now. ! ")
print("\t ! Use this format to enter date: 'YYYY.MM.DD' ! \n")
time.sleep(2)
clear()
continue
e1.start_time = EventManagerDB.data_into_event_object(e1, Validate.validate_time, "Start Time: ", TIME_ERR)
e1.end_time = EventManagerDB.data_into_event_object(e1, Validate.validate_time, "End Time: ", TIME_ERR)
while not e1.is_starttime_before_endtime():
print("\n\t ! The starting time should be before the ending time. ! ")
time.sleep(2)
clear()
e1.end_time = ""
e1.end_time = EventManagerDB.data_into_event_object(e1, Validate.validate_time, "End Time: ", TIME_ERR)
e1.zip_code = EventManagerDB.data_into_event_object(e1, Validate.validate_zipcode, "ZIP code: ", ZIP_ERR)
e1.city = EventManagerDB.data_into_event_object(e1, Validate.validate_city_name, "City: ", CITY_ERR)
e1.address = EventManagerDB.data_into_event_object(e1, Validate.validate_address, "Address of event: ", ADDRESS_ERR)
e1.available_beds = EventManagerDB.data_into_event_object(e1, Validate.validate_positive_int, "Available beds: ", POSINT_ERR)
e1.planned_donor_number = EventManagerDB.data_into_event_object(e1, Validate.validate_positive_int, "Planned donor number: ", POSINT_ERR)
e1.successfull = EventManagerDB.data_into_event_object(e1, Validate.validate_positive_int, "\n How many successfull donation was on the event?\n > ", POSINT_ERR)
print("\nThe required functions: \n")
print("Weekday :", e1.is_weekday())
e1.duration = e1.calculate_duration()
print("Duration: {} min -- {} hours ".format(e1.duration, round(e1.duration/60, 1)))
print("Maximum donor number:", e1.max_donor_number())
print("Success rate: {}".format(e1.success_rate()))
input("\n\n (Press ENTER to go BACK)")
EventManagerDB.store_donation_data(e1, cursor_object)
clear()
break
示例2: test_mukodo
# 需要導入模塊: from validation import Validate [as 別名]
# 或者: from validation.Validate import validate_date [as 別名]
def test_mukodo(self):
self.assertTrue(Validate.validate_date("1991.02.10"))
示例3: test_nothing
# 需要導入模塊: from validation import Validate [as 別名]
# 或者: from validation.Validate import validate_date [as 別名]
def test_nothing(self):
self.assertFalse(Validate.validate_date(""))
示例4: test_nemmukodo
# 需要導入模塊: from validation import Validate [as 別名]
# 或者: from validation.Validate import validate_date [as 別名]
def test_nemmukodo(self):
self.assertFalse(Validate.validate_date("19910210"))
示例5: test_nemteljes
# 需要導入模塊: from validation import Validate [as 別名]
# 或者: from validation.Validate import validate_date [as 別名]
def test_nemteljes(self):
self.assertFalse(Validate.validate_date("1991.02."))
示例6: test_pontalkezdodo
# 需要導入模塊: from validation import Validate [as 別名]
# 或者: from validation.Validate import validate_date [as 別名]
def test_pontalkezdodo(self):
self.assertFalse(Validate.validate_date(".02.10"))