def test_readinto(self, name, BQM):

        bqm = BQM(np.triu(np.arange(25).reshape((5, 5))), 'BINARY')
        bqm.offset = 14

        fv = FileView(bqm)

        num_bytes = fv.quadratic_end

        # make a buffer that's a bit bigger
        buff = bytearray(num_bytes + 10)

        self.assertEqual(fv.readinto(buff), num_bytes)

        # reset and make sure that a total read it the same
        fv.seek(0)
        self.assertEqual(fv.read(), buff[:num_bytes])
    def test_readinto(self, BQM):
        if issubclass(BQM, dimod.AdjDictBQM):
            # not (yet) implemented for non cybqms
            return

        bqm = BQM(np.triu(np.arange(25).reshape((5, 5))), 'BINARY')
        bqm.offset = 14

        fv = FileView(bqm)

        num_bytes = fv.quadratic_end

        # make a buffer that's a bit bigger
        buff = bytearray(num_bytes + 10)

        self.assertEqual(fv.readinto(buff), num_bytes)

        # reset and make sure that a total read it the same
        fv.seek(0)
        self.assertEqual(fv.read(), buff[:num_bytes])