当前位置: 首页>>代码示例>>Python>>正文


Python Validate.validate_date方法代码示例

本文整理汇总了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
开发者ID:AndrasKesik,项目名称:Python_BloodDonorRegistration,代码行数:46,代码来源:event_manager_db.py

示例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"))
开发者ID:AndrasKesik,项目名称:Python_BloodDonorRegistration,代码行数:4,代码来源:validation_tests.py

示例3: test_nothing

# 需要导入模块: from validation import Validate [as 别名]
# 或者: from validation.Validate import validate_date [as 别名]
 def test_nothing(self):
     self.assertFalse(Validate.validate_date(""))
开发者ID:AndrasKesik,项目名称:Python_BloodDonorRegistration,代码行数:4,代码来源:validation_tests.py

示例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"))
开发者ID:AndrasKesik,项目名称:Python_BloodDonorRegistration,代码行数:4,代码来源:validation_tests.py

示例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."))
开发者ID:AndrasKesik,项目名称:Python_BloodDonorRegistration,代码行数:4,代码来源:validation_tests.py

示例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"))
开发者ID:AndrasKesik,项目名称:Python_BloodDonorRegistration,代码行数:4,代码来源:validation_tests.py


注:本文中的validation.Validate.validate_date方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。