Ejemplo n.º 1
0
    def test_givenABPembDownload_whenModelIsNotLocal_thenDownloadWeights(self, download_embeddings_mock):
        args_parser = self.parser.parse_args([self.a_bpemb_model_type])

        with patch("deepparse.download.download_weights") as downloader:
            download.main(args_parser)

            downloader.assert_any_call(self.a_bpemb_model_type, self.fake_cache_path)
Ejemplo n.º 2
0
    def test_givenABPembDownload_whenModelIsNotLocal_thenDownloadEmbeddings(self, weights_download_mock):
        args_parser = self.parser.parse_args([self.a_bpemb_model_type])

        with patch("deepparse.download.BPEmb") as downloader:
            download.main(args_parser)

            downloader.assert_any_call(lang="multi", vs=100000, dim=300)  # settings for BPemb
Ejemplo n.º 3
0
    def test_givenAFasttextMagnitudeDownload_whenModelIsNotLocal_thenDownloadEmbeddings(self, weights_download_mock):
        args_parser = self.parser.parse_args([self.a_fasttext_light_model_type])

        with patch("deepparse.download.download_fasttext_magnitude_embeddings") as downloader:
            download.main(args_parser)

            downloader.assert_any_call(saving_dir=self.fake_cache_path)
Ejemplo n.º 4
0
    def test_givenAFasttextDownload_whenModelIsLocalButNotLatest_thenDownloadWeights(
            self, download_embeddings_mock, os_is_file_mock, latest_version_mock):
        args_parser = self.parser.parse_args([self.a_fasttext_model_type])
        with patch("deepparse.download.download_weights") as downloader:
            download.main(args_parser)

            downloader.assert_any_call(self.a_fasttext_model_type, self.fake_cache_path)
Ejemplo n.º 5
0
    def test_givenAFasttextDownload_whenModelIsLocalAndGoodVersion_thenDoNoting(self, download_embeddings_mock,
                                                                                os_is_file_mock, latest_version_mock):
        args_parser = self.parser.parse_args([self.a_fasttext_model_type])

        with patch("deepparse.download.download_weights") as downloader:
            download.main(args_parser)

            downloader.assert_not_called()
Ejemplo n.º 6
0
    def test_givenABPembDownload_whenModelIsLocalAndGoodVersion_thenDoNoting(self, download_embeddings_mock,
                                                                             os_is_file_mock, latest_version_mock):
        os_is_file_mock.return_value = True
        latest_version_mock.return_value = True  # the latest version
        args_parser = self.parser.parse_args([self.a_bpemb_model_type])

        with patch("deepparse.download.download_weights") as downloader:
            download.main(args_parser)

            downloader.assert_not_called()