Esempio n. 1
0
    def test_isotherm_from_json_file(self, basic_pointisotherm,
                                     tmpdir_factory):
        """Test the parsing of an isotherm to a json file."""

        path = tmpdir_factory.mktemp('json').join('isotherm.json').strpath
        pygaps.isotherm_to_json(basic_pointisotherm, path)
        isotherm = pygaps.isotherm_from_json(path)

        assert isotherm == basic_pointisotherm
Esempio n. 2
0
    def save(self, path, ext):
        """Save isotherm to disk."""
        isotherm = self.iso_list_model.get_iso_index(
            self.list_view.currentIndex())

        if ext == '.csv':
            pygaps.isotherm_to_csv(isotherm, path)
        elif ext == '.json':
            pygaps.isotherm_to_json(isotherm, path)
        elif ext == '.xls' or ext == '.xlsx':
            pygaps.isotherm_to_xl(isotherm, path)
        elif ext == '.aif':
            pygaps.isotherm_to_aif(isotherm, path)
        else:
            raise Exception("Unknown file save format.")
Esempio n. 3
0
    def test_modelisotherm_to_json(self, basic_modelisotherm):
        """Test the parsing of an ModelIsotherm to json."""

        test_isotherm_json = pygaps.isotherm_to_json(basic_modelisotherm)
        new_isotherm = pygaps.isotherm_from_json(test_isotherm_json)

        assert basic_modelisotherm.to_dict() == new_isotherm.to_dict()
Esempio n. 4
0
    def test_pointisotherm_to_json(self, basic_pointisotherm):
        """Test the parsing of a PointIsotherm to json."""

        test_isotherm_json = pygaps.isotherm_to_json(basic_pointisotherm)
        new_isotherm = pygaps.isotherm_from_json(test_isotherm_json)

        assert basic_pointisotherm == new_isotherm
Esempio n. 5
0
    def test_isotherm_to_json_self(self, basic_isotherm):
        """Test the parsing of an isotherm to json from the class function."""

        isotherm_json_std = pygaps.isotherm_to_json(basic_isotherm)
        new_isotherm_cls = basic_isotherm.to_json()

        assert isotherm_json_std == new_isotherm_cls