Esempio n. 1
0
    def test_above_freezing_at_zero(self):
        """Test a temperature that is at freezing."""

        expected = False
        actual = temperature.above_freezing(0)
        self.assertEqual(expected, actual,
                         "The temperature is at the freezing mark.")
Esempio n. 2
0
    def test_above_freezing_above(self):
        """Test a temperature that is above freezing."""

        expected = True
        actual = temperature.above_freezing(5.2)
        self.assertEqual(expected, actual,
                         "The temperature is above freezing.")
    def test_above_freezing_above(self):
        """어떤 온도가 어는점보다 높은지 테스트한다."""

        expected = True
        actual = temperature.above_freezing(5.2)
        self.assertEqual(expected, actual,
                         "The temperature is above freezing.")
Esempio n. 4
0
    def test_above_freezing_below(self):
        """Test a temperature that is below freezing."""

        expected = False
        actual = temperature.above_freezing(-2)
        self.assertEqual(expected, actual,
                         "The temperature is below freezing.")
    def test_above_freezing_at_zero(self):
        """어떤 온도가 어는점과 같은지 테스트한다."""

        expected = False
        actual = temperature.above_freezing(0)
        self.assertEqual(expected, actual,
                         "The temperature is at the freezing mark.")
    def test_above_freezing_below(self):
        """어떤 온도가 어는점보다 낮은지 테스트한다."""

        expected = False
        actual = temperature.above_freezing(-2)
        self.assertEqual(expected, actual,
                         "The temperature is below freezing.")
Esempio n. 7
0
def test_above_freezing():  # 测试函数的名称也必须以“test”开头。
    print '''Test 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'
Esempio n. 8
0
...
    convert_to_celsius(75)
    23.88888888888889
    """
    return (fahrenheit - 32.0) * 5.0 / 9.0
...

 

# If you save this function definition into a file names
# temperature.py, you can import it as a module. 

 
import temperature
celsius = temperature.convert_to_celsius(33.3)
temperature.above_freezing(celsius)
# True

 



#-------------------------------------------------
### What Happens During Import
#-------------------------------------------------

# Let's try an experiment: save the following command in a file 
# called experiment.py. 

 
print("The panda's scientific name is 'Ailuropoda melanoleuca'")
def test_above_freezing ():
	'''Test 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 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'
Esempio n. 11
0
    def test_above_freezing_above(self):
        """Test a temperature that is above freezing."""

        expected = True
        actual = temperature.above_freezing(5.2)
        self.assertEqual(expected, actual, "The temperature is above freezing.")
Esempio n. 12
0
    def test_above_freezing_at_zero(self):
        """Test a temperature that is at freezing."""

        expected = False
        actual = temperature.above_freezing(0)
        self.assertEqual(expected, actual, "The temperature is at the freezing mark.")
Esempio n. 13
0
    def test_above_freezing_below(self):
        """Test a temperature that is below freezing."""

        expected = False
        actual = temperature.above_freezing(-2)
        self.assertEqual(expected, actual, "The temperature is below freezing.")