コード例 #1
0
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.'
コード例 #2
0
def test_above_freezing():
    '''Test function for above_freezing working when above freezing.'''
    assert above_freezing(89.4), 'A temperature above freezing.'
コード例 #3
0
def test_below_freezing():
    '''Test function for above_freezing working when below freezing.'''
    assert not above_freezing(-42), 'A temperature below freezing.'
コード例 #4
0
ファイル: PP_Ch_06_B.py プロジェクト: hazza1999/ECP3004S21

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
コード例 #5
0
def test_at_freezing():
    '''Test function for above_freezing working when at freezing.'''
    assert not above_freezing(0), 'A temperature at freezing.'
コード例 #6
0
ファイル: test_freezing.py プロジェクト: kimihito/introcs
def test_above_freezing():
  '''above_freezingのテスト関数'''
  assert above_freezing(89.4),'氷点よりも高い温度'
  assert not above_freezing(-42),'氷点よりも低い温度'
  assert not above_freezing(0),'ちょうど氷点'
コード例 #7
0
def test_below_freezing():
    '''Test function for above_freezing working when below freezing.'''
    assert not above_freezing(-42), 'A temperature below freezing.'
コード例 #8
0
def test_above_freezing():
    '''Test function for above_freezing working when above freezing.'''
    assert above_freezing(89.4), 'A temperature above freezing.'
コード例 #9
0
def test_at_freezing():
    '''Test function for above_freezing working when at freezing.'''
    assert not above_freezing(0), 'A temperature at freezing.'
コード例 #10
0
ファイル: test_freezing.py プロジェクト: Bambina/learning-py
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.'