'Test that the string generated by an Avro Protocol object
is, in fact, a valid Avro protocol.'

def test_valid_cast_to_string_after_parse(self):

    print ''
    print 'TEST    CAST    TO    STRING'
    print '==================='
    print ''
    num_correct = 0
    for example in VALID_EXAMPLES:
        protocol_data = protocol.parse(example.protocol_string)
        try:
            protocol.parse(str(protocol_data))
            debug_msg = ('%s:    STRING    CAST    SUCCESS' % example.name)
            num_correct += 1
        except:
            debug_msg = ('%s:    STRING    CAST    FAILURE' % example.name)
        finally:
            print debug_msg
    fail_msg = ('Cast    to    string    success    on    %d    out    of    %d    protocols' % (num_correct, len(VALID_EXAMPLES)))
    self.assertEqual(num_correct, len(VALID_EXAMPLES), fail_msg)
