Since the initial exploration of the X-and soft γ-ray sky in the 60's, high-energy celestial sources have been mainly characterized through imaging, spectroscopy and timing analysis. Despite tremendous progress in the field, the radiation mechanisms at work in sources such as neutrons stars, black holes, and Active Galactic Nuclei are still unclear. The polarization state of the radiation is an observational parameter which brings key additional information about the physical processes in these high energy sources, allowing the discrimination between competing models which may otherwise all be consistent with other types of measurement. This is why most of the projects for the next generation of space missions covering the few tens of keV to the MeV region require a polarization measurement capability. A key element enabling this capability, in this energy range, is a detector system allowing the identification and characterization of Compton interactions as they are the main process at play. The compact hard X-ray imaging spectrometer module, developed in CEA with the generic name of "Caliste" module, is such a detector.In this paper, we present experimental results for two types of Caliste-256 modules, one based on a CdTe crystal, the other one on a CdZnTe crystal, which have been exposed to linearly polarized beams at the European Synchrotron Radiation Facility (ESRF). These results, obtained at 200 and 300 keV, demonstrate the capability of these modules to detect Compton events and to give an accurate determination of the polarization parameters (polarization angle and fraction) of the incoming beam. For example, applying an optimized selection to our data set, equivalent to select 90 degrees Compton scattered interactions in the detector plane, we find a modulation factor Q of 0.78 ± 0.06 in the 200 -300 keV range. The polarization angle and fraction are derived with accuracies of approximately 1° and 5 % respectively for both CdZnTe and CdTe crystals. The modulation factor remains larger than 0.4 when essentially no selection is made at all on the data.We also present in this paper a simple analytical model of the interactions for the detector geometry. We show that the experimental data compare very well with the simulation, and that simple geometrical effects explain some of the observed deviations between the data and the simulation.All of these results, both experimental and from simulations, prove that the Caliste-256 modules have performances allowing them to be excellent candidates as detectors with polarimetric capabilities, in particular for future space missions.