示例#1
0
def test_7():
    assert close_far(0, -1, 10) is True
示例#2
0
def test_5():
    assert close_far(4, 3, 5) is False
示例#3
0
def test_6():
    assert close_far(-1, 10, 0) is True
def test_close_far_positive_case():
    assert close_far(1, 2, 10)
示例#5
0
 def test_4_1_and_3_returns_true(self):
     actual = close_far(4, 1, 3)
     expected = True
     self.assertEqual(
         actual, expected,
         'Expected calling close_far() with 4, 1, and 3 to return "True"')
示例#6
0
def test_10():
    assert close_far(8, 9, 10) is False
示例#7
0
def test_12():
    assert close_far(8, 6, 9) is True
示例#8
0
 def test_8_9_and_7_returns_false(self):
     actual = close_far(8, 9, 7)
     expected = False
     self.assertEqual(
         actual, expected,
         'Expected calling close_far() with 8, 9, and 7 to return "False"')
示例#9
0
 def test_8_6_and_9_returns_true(self):
     actual = close_far(8, 6, 9)
     expected = True
     self.assertEqual(
         actual, expected,
         'Expected calling close_far() with 8, 6, and 9 to return "True"')
示例#10
0
 def test_10_10_and_8_returns_true(self):
     actual = close_far(10, 10, 8)
     expected = True
     self.assertEqual(
         actual, expected,
         'Expected calling close_far() with 10, 10, and 8 to return "True"')
示例#11
0
 def test_10_8_and_9_returns_false(self):
     actual = close_far(10, 8, 9)
     expected = False
     self.assertEqual(
         actual, expected,
         'Expected calling close_far() with 10, 8, and 9 to return "False"')
示例#12
0
 def test_1_2_and_10_returns_true(self):
     actual = close_far(1, 2, 10)
     expected = True
     self.assertEqual(
         actual, expected,
         'Expected calling close_far() with 1, 2, and 10 to return "True"')
示例#13
0
 def test_0_negative_1_and_10_returns_true(self):
     actual = close_far(0, -1, 10)
     expected = True
     self.assertEqual(
         actual, expected,
         'Expected calling close_far() with 0, -1, and 10 to return "True"')
示例#14
0
 def test_4_3_and_5_returns_false(self):
     actual = close_far(4, 3, 5)
     expected = False
     self.assertEqual(
         actual, expected,
         'Expected calling close_far() with 4, 5, and 3 to return "False"')
示例#15
0
def test_8():
    assert close_far(10, 10, 8) is True
示例#16
0
def test_1():
    assert close_far(1, 2, 10) is True
示例#17
0
def test_9():
    assert close_far(10, 8, 9) is False
示例#18
0
def test_2():
    assert close_far(1, 2, 3) is False
示例#19
0
def test_11():
    assert close_far(8, 9, 7) is False
示例#20
0
def test_3():
    assert close_far(4, 1, 3) is True
from close_far import close_far
"""
Given three ints, a b c, return True if one of b or c is "close" (differing from a by at most 1),
while the other is "far", differing from both other values by 2 or more.

Note: abs(num) computes the absolute value of a number.


close_far(1, 2, 10) → True
close_far(1, 2, 3) → False
close_far(4, 1, 3) → True
"""


def test_close_far_positive_case():
    assert close_far(1, 2, 10)


def test_close_far_negative_case():
    assert not close_far(1, 2, 3)
示例#22
0
def test_4():
    assert close_far(4, 5, 3) is False
def test_close_far_negative_case():
    assert not close_far(1, 2, 3)
示例#24
0
 def test_1_2_and_3_returns_false(self):
     actual = close_far(1, 2, 3)
     expected = False
     self.assertEqual(
         actual, expected,
         'Expected calling close_far() with 1, 2, and 3 to return "False"')