'Test addition & subtraction'

def testAddition(self):

    d1 = D(m=100)
    d2 = D(m=200)
    d3 = (d1 + d2)
    self.assertEqual(d3.m, 300)
    d3 += d1
    self.assertEqual(d3.m, 400)
    d4 = (d1 - d2)
    self.assertEqual(d4.m, (-100))
    d4 -= d1
    self.assertEqual(d4.m, (-200))
    try:
        d5 = (d1 + 1)
    except TypeError as e:
        pass
    else:
        self.fail('Distance    +    number    should    raise    TypeError')
    try:
        d5 = (d1 - 1)
    except TypeError as e:
        pass
    else:
        self.fail('Distance    -    number    should    raise    TypeError')
    try:
        d1 += 1
    except TypeError as e:
        pass
    else:
        self.fail('Distance    +=    number    should    raise    TypeError')
    try:
        d1 -= 1
    except TypeError as e:
        pass
    else:
        self.fail('Distance    -=    number    should    raise    TypeError')
