Beispiel #1
0
def test_givenZeroInchValueInstanceVariable_WhenCompared_ShouldReturnTrue():
    first_inch = QuantityMeasurement(Length.INCH, 0.0)
    second_inch = first_inch
    assert first_inch == second_inch
Beispiel #2
0
def test_givenZeroInchValue_WhenComparedIfNotNone_ShouldReturnTrue():
    first_inch = QuantityMeasurement(Length.INCH, 0.0)
    assert first_inch is not None
Beispiel #3
0
def test_givenZeroYardandOneYard_WhenCompared_ShouldReturnFalse():
    first_yard = QuantityMeasurement(Length.YARD, 0.0)
    second_yard = QuantityMeasurement(Length.YARD, 1.0)
    assert first_yard != second_yard
Beispiel #4
0
def test_givenZeroFtandZeroFt_WhenCompared_ShouldReturnTrue():
    first_feet = QuantityMeasurement(Length.FEET, 2.0)
    second_feet = QuantityMeasurement(Length.FEET, 2.0)
    assert first_feet == second_feet
Beispiel #5
0
def test_givenZeroYardValue_WhenComparedIfNotNone_ShouldReturnTrue():
    first_yard = QuantityMeasurement(Length.YARD, 0.0)
    assert first_yard is not None
Beispiel #6
0
def test_givenZeroYardAndFloatValue_WhenCompared_ShouldReturnTrue():
    first_yard = QuantityMeasurement(Length.YARD, 0.0)
    second_yard = float(0.0)
    with pytest.raises(AttributeError):
        assert first_yard == second_yard
Beispiel #7
0
def test_givenZeroFeetandOneFeet_WhenCompared_ShouldReturnFalse():
    first_feet = QuantityMeasurement(Length.FEET, 0.0)
    second_feet = QuantityMeasurement(Length.FEET, 1.0)
    assert first_feet != second_feet
Beispiel #8
0
def test_given_OneInch_And_OneYardValue_WhenCompared_ShouldReturnFalse():
    first_inch = QuantityMeasurement(Length.INCH, 1.0)
    second_yard = QuantityMeasurement(Length.YARD, 1.0)
    assert first_inch != second_yard
Beispiel #9
0
def test_givenZeroFtValue_WhenComparedIfNotNone_ShouldReturnTrue():
    first_feet = QuantityMeasurement(Length.FEET, 0.0)
    assert first_feet is not None
Beispiel #10
0
def test_givenZeroFeetAndFloatValue_WhenCompared_ShouldReturnTrue():
    first_feet = QuantityMeasurement(Length.FEET, 0.0)
    second_feet = float(0.0)
    with pytest.raises(AttributeError):
        assert first_feet == second_feet
Beispiel #11
0
def test_givenTwoInchAndFiveCMValue_WhenCompared_ShouldReturnTrue():
    first_inch = QuantityMeasurement(Length.INCH, 2.0)
    second_cm = QuantityMeasurement(Length.CM, 5.0)
    with pytest.raises(AssertionError):
        assert first_inch == second_cm
Beispiel #12
0
def test_given_OneYardAnd_36InchValue_WhenCompared_ShouldReturnTrue():
    first_yard = QuantityMeasurement(Length.YARD, 1.0)
    second_inch = QuantityMeasurement(Length.INCH, 36.0)
    with pytest.raises(AssertionError):
        assert first_yard == second_inch
Beispiel #13
0
def test_given_1Yard_And_3FeetValue_WhenCompared_ShouldReturnTrue():
    first_yard = QuantityMeasurement(Length.YARD, 1.0)
    second_feet = QuantityMeasurement(Length.FEET, 3.0)
    with pytest.raises(AssertionError):
        assert first_yard == second_feet
Beispiel #14
0
def test_givenZeroInchAndFloatValue_WhenCompared_ShouldReturnTrue():
    first_inch = QuantityMeasurement(Length.INCH, 0.0)
    second_inch = float(0.0)
    with pytest.raises(AttributeError):
        assert first_inch == second_inch
Beispiel #15
0
def test_givenZeroYardValueandInstanceVariable_WhenCompared_ShouldReturnTrue():
    first_yard = QuantityMeasurement(Length.YARD, 0.0)
    second_yard = first_yard
    assert first_yard == second_yard
Beispiel #16
0
def test_givenZeroInchandOneInch_WhenCompared_ShouldReturnFalse():
    first_inch = QuantityMeasurement(Length.INCH, 0.0)
    second_inch = QuantityMeasurement(Length.INCH, 1.0)
    assert first_inch != second_inch
Beispiel #17
0
def test_given_1FeetAnd_1YardValue_WhenCompared_ShouldReturnFalse():
    first_feet = QuantityMeasurement(Length.FEET, 1.0)
    second_yard = QuantityMeasurement(Length.YARD, 1.0)
    assert first_feet != second_yard