def test_random_value():
	fahr=randint(0,randint(0,100))
	assert fahr_to_kelvin(fahr)==((fahr - 32) * (5/9))+273.15

#@raises(TypeError)
#def test_temp_string():
#	assert fahr_to_kelvin("SomeTemperature")

#@raises(TypeError)
#def test_null_temp():
#	assert fahr_to_kelvin()
def test_string():
    fahr_to_kelvin("Something")
Beispiel #3
0
def test_zero_kelvin():
    assert fahr_to_kelvin(-459.67) == -5.684341886080802e-14
Beispiel #4
0
def test_null_input():
    fahr_to_kelvin()
Beispiel #5
0
def test_negative_fahr():
    assert round(fahr_to_kelvin(-100), 2) == 199.82
def test_basic():
	"""basic test"""
	npt.assert_almost_equal(fahr_to_kelvin(20), 266.483333, decimal=2)
Beispiel #7
0
""" Climate analysis tools """
import sys
import temp_conversion
import signal
signal.signal(signal.SIGPIPE, signal.SIG_DFL)

script = sys.argv[0]
assert len(sys.argv) == 2, script + ": requires filename"
filename = sys.argv[1]

climate_data = open(filename, 'r')

for line in climate_data:
    data = line.split(',')

    if data[0][0] == '#':
        # don't want to process comment lines, which start with '#'
        pass
    else:
        # extract our max temperature in Fahrenheit - 4th column
        fahr = float(data[3])

        # don't process invalid temperature readings of -9999
        if fahr != -9999:
            celsius = temp_conversion.fahr_to_celsius(fahr)
            kelvin = temp_conversion.fahr_to_kelvin(fahr)

            print(str(celsius)+", "+str(kelvin))

#TODO(ementzakis): Add a call to process rainfall
def test_fahr_to_kelvin():
    assert fahr_to_kelvin(32) == 273.15
def test_run_3():
    assert round(fahr_to_kelvin(-459.67),2) == 0.00 
def test_run_2():
    assert fahr_to_kelvin('nn') == 0
def test_run_1():
    assert fahr_to_kelvin (40) == 277.59444444444443
def test_temp_null():
    assert fahr_to_kelvin()
def test_fahr_kelvin_abs_zero_input():
    assert fahr_to_kelvin(-460) == 0.0
Beispiel #14
0
def test_negative():
    assert fahr_to_kelvin(-10.0) == 249.81666666666663
Beispiel #15
0
def test_working():
    assert fahr_to_kelvin(13.0) == 262.59444444444443
def test_zero_kelvin():
    assert fahr_to_kelvin(-459.67) == -5.684341886080802e-14
def test_temp_string():
    assert fahr_to_kelvin("Sometemperature")
def test_kelvin1():
    assert round(fahr_to_kelvin(10), 3) == 260.928
def test_zero():
	assert round(fahr_to_kelvin(-459.67),2)==0.00
def test_kelvin2():
    assert round(fahr_to_kelvin(-200), 3) == 144.261	
Beispiel #21
0
def test_empty():
    assert fahr_to_kelvin()  #trying to test for empty entry but not working.
def strin_test():
	assert fahr_to_kelvin("some string")
Beispiel #23
0
def test_zero_kelvin_better():
    assert round(fahr_to_kelvin(-459.67), 2) == 0.00
def kel_test_null():
    fahr_to_kelvin(0)==(-32*(5/9))-273.15
Beispiel #25
0
def test_string():
    fahr_to_kelvin("Something")
def test_fahr_greater():
    assert fahr_to_kelvin(-10) > 0
Beispiel #27
0
def test_basic_value():
    assert fahr_to_kelvin(20.0) == 266.4833333333333
def test_zero_celsius():
    assert fahr_to_kelvin(32) == 273.15
def test_negative_fahr():
    assert round(fahr_to_kelvin(-100),2) == 199.82
def test_temp_string():
    assert fahr_to_kelvin()
def test_null_input():
    fahr_to_kelvin()
def fahr_to_kelvin_basic():
    assert fahr_to_kelvin(20.0)==244
def test_non_negative_kelvin():
	assert fahr_to_kelvin(0)>=0, "kelvin must be non-negative"
def test_null_temp():
   assert fahr_to_kelvin()
def test_basic_value():
    assert fahr_to_kelvin(20)==266.4833333333333
def test_zero():
   assert fahr_to_kelvin(0.)==255.372222
def test_random():
	assert fahr_to_kelvin(20.0)==266.4833333333333
def test_zero_kelvin():
	"""test for zero kelvin"""
	npt.assert_almost_equal(fahr_to_kelvin(-459.67), 0.0, decimal=2)
def test_positive():
	assert fahr_to_kelvin(50)>=273
def test_temp_string():
	"""check that a type error occurs"""
	assert fahr_to_kelvin("SomeTemperature")
import sys
import temp_conversion
import signal

signal.signal(signal.SIGPIPE, signal.SIG_DFL)

script = sys.argv[0]
assert len(sys.argv) == 2, script + ": requires filename"
filename = sys.argv[1]

climate_data = open(filename, 'r')

for line in climate_data:
    data = line.split(',')

    if data[0][0] == '#':
        # don't want to process comment lines, which start with '#'
        pass
    else:
        # extract our max temperature in Fahrenheit - 4th column
        fahr = float(data[3])

        # don't process invalid temperature readings of -9999
        if fahr != -9999:
            celsius = temp_conversion.fahr_to_celsius(fahr)
            kelvin = temp_conversion.fahr_to_kelvin(fahr)

            print(str(celsius) + ", " + str(kelvin))

# TODO (jamie): Add call to process rainfall
Beispiel #42
0
def test_integer():
    assert fahr_to_kelvin(13) == 262.59444444444443