def METHOD_NAME(self):
    path = os.path.join(self.tmpdir, "foo.xz")
    f = cr.CrFile(path, cr.MODE_WRITE, cr.XZ_COMPRESSION)
    self.assertTrue(f)
    self.assertTrue(os.path.isfile(path))
    f.write("foobar")
    f.close()
    import subprocess
    with subprocess.Popen(["unxz", "--stdout", path], stdout=subprocess.PIPE, close_fds=False) as p:
        content = p.stdout.read().decode('utf-8')
        self.assertEqual(content, "foobar")