예제 #1
0
def test_dayofweek():
    month = 1
    d = 15
    year = 2019
    result = date(month, d, year)
    expected = 2
    assert result == expected
예제 #2
0
def test_dayofweekspecial():
    with pytest.raises(TypeError):
        result = date(json_string['dayofweek'][2]['input1'],
                      json_string['dayofweek'][2]['input2'],
                      json_string['dayofweek'][2]['input3'])
        expected = json_string['dayofweek'][2]['output']
        assert result == expected
예제 #3
0
def test_dayofweekinteger():
    result = date(json_string['dayofweek'][3]['input1'],
                  json_string['dayofweek'][3]['input2'],
                  json_string['dayofweek'][3]['input3'])
    expected = json_string['dayofweek'][3]['output']
    assert result == expected
예제 #4
0
Name    : DayOfWeek.py
Date    : 26/08/2019
Purpose : Take a date as input and print the day of the week that date falls on.

"""

from Utility import utility

#Getting the month,date and year from the user
while True:
    try:
        month = int(
            input("Enter the month : 1 for january,2 for february,..etc : "))
        if (month < 1 or month > 12):
            print("Enter a number from 1 to 12")
            continue
        date = int(input("Enter the date : "))
        if (date < 1 or date > 31):
            print("Enter a number from 1 to 31")
            continue
        year = int(input("Enter the year : "))
        if (len(str(year)) != 4):
            print("Please enter a 4 digit year : ")
            continue
        break
    except ValueError:
        print("Enter everything as numbers only")

#Calling the function in the BL file
d = utility.date(month, date, year)
print(d)