'Run through a ref counting cycle with a copy.'

@skip_pypy
def test_lifecycle1(self):

    for i in range(5, 16):
        s = ((2 ** i) * x)
        rc = 2
        self.assertEqual(grc(s), rc)
        m = zmq.Frame(s)
        rc += 2
        self.assertEqual(grc(s), rc)
        m2 = copy.copy(m)
        rc += 1
        self.assertEqual(grc(s), rc)
        buf = m2.buffer
        rc += view_rc
        self.assertEqual(grc(s), rc)
        self.assertEqual(s, b(str(m)))
        self.assertEqual(s, bytes(m2))
        self.assertEqual(s, m.bytes)
        del m2
        rc -= 1
        self.assertEqual(grc(s), rc)
        rc -= view_rc
        del buf
        self.assertEqual(grc(s), rc)
        del m
        rc -= 2
        await_gc(s, rc)
        self.assertEqual(grc(s), rc)
        self.assertEqual(rc, 2)
        del s
