コード例 #1
0
    def test_error_input_model_no_framework(self, mock_argparse):
        # Framework is not specified and 'abc.qwerty' is not supported
        # so MO shall not convert anything and produce specified error
        with self.assertLogs() as logger:
            main(argparse.ArgumentParser(), fem, None)

        stat = get_frontend_statistic()

        assert [s for s in logger.output if 'can not be deduced' in s]

        # verify that 'supported' was called
        assert stat.supported == 1
コード例 #2
0
    def test_simple_convert(self, mock_argparse):
        f = io.StringIO()
        with redirect_stdout(f):
            main(argparse.ArgumentParser(), fem, 'mock_mo_ngraph_frontend')
            out = f.getvalue()

        xml_file = re.search(r'\[ SUCCESS \] XML file: (.*)', out).\
            group(1).replace("\r", "")
        bin_file = re.search(r'\[ SUCCESS \] BIN file: (.*)', out).\
            group(1).replace("\r", "")
        assert xml_file and bin_file

        # verify that 'convert' was called
        stat = get_frontend_statistic()
        assert stat.convert_model == 1
        # verify that meta info is added to XML file
        with open(xml_file) as file:
            assert 'mock_mo_ngraph_frontend' in file.read()
コード例 #3
0
    def test_convert_framework_discover(self, mock_argparse):
        f = io.StringIO()
        with redirect_stdout(f):
            main(argparse.ArgumentParser(), fem, None)
            out = f.getvalue()

        xml_file = re.search(r'\[ SUCCESS \] XML file: (.*)', out). \
            group(1).replace("\r", "")
        bin_file = re.search(r'\[ SUCCESS \] BIN file: (.*)', out). \
            group(1).replace("\r", "")
        assert xml_file and bin_file

        # verify that 'convert', 'supported' and 'get_name' were called
        stat = get_frontend_statistic()
        assert stat.convert_model == 1
        assert stat.supported == 1
        assert stat.get_name > 0

        # verify that meta info is added to XML file
        with open(xml_file) as file:
            assert 'ov_mock_mo_frontend' in file.read()