'Small modifications to sets have diffs that are small. Their reverse
is also small.'

def test_set_diffing_smart(self):

    application = application_strategy(min_number_of_ports=1000).example()
    new_ports = list((Port(internal_port=i, external_port=i) for i in xrange(4)))
    a = reduce((lambda x, y: x.transform(['ports'], (lambda x: x.add(y)))), new_ports, application)
    encoded_application = wire_encode(application)
    diff = create_diff(application, a)
    encoded_diff = wire_encode(diff)
    self.assertThat(len(encoded_diff), LessThan((len(encoded_application) / 2)))
    self.assertThat(wire_decode(encoded_diff).apply(application), Equals(a))
    removal_diff = create_diff(a, application)
    encoded_removal_diff = wire_encode(removal_diff)
    self.assertThat(len(encoded_removal_diff), LessThan((len(encoded_application) / 2)))
    self.assertThat(wire_decode(encoded_removal_diff).apply(a), Equals(application))
