def test_above_freezing(): '''Test function for above_freezing.''' assert above_freezing(89.4), 'A temperature above freezing.' assert not above_freezing(-42), 'A temperature below freezing.' assert not above_freezing(0), 'A temperature at freezing.'
def test_above_freezing(): '''Test function for above_freezing working when above freezing.''' assert above_freezing(89.4), 'A temperature above freezing.'
def test_below_freezing(): '''Test function for above_freezing working when below freezing.''' assert not above_freezing(-42), 'A temperature below freezing.'
def above_freezing(celsius: float) -> bool: """Return True iff temperature celsius degrees is above freezing. above_freezing(5.2) True above_freezing(-2) False """ return celsius > 0 fahrenheit = float(input('Enter the temperature in degrees Fahrenheit: ')) celsius = convert_to_celsius(fahrenheit) if above_freezing(celsius): print('It is above freezing.') else: print('It is below freezing.') # When this module is run, it runs the block of code at the bottom and # asks the user for input. # Now create another module, baking.py that imports the # above temperature_program module. import temperature_program
def test_at_freezing(): '''Test function for above_freezing working when at freezing.''' assert not above_freezing(0), 'A temperature at freezing.'
def test_above_freezing(): '''above_freezingのテスト関数''' assert above_freezing(89.4),'氷点よりも高い温度' assert not above_freezing(-42),'氷点よりも低い温度' assert not above_freezing(0),'ちょうど氷点'