Ejemplo n.º 1
0
 def test_yml(self):
     with tempfile.TemporaryDirectory() as tempdir:
         temp_filepath = os.path.join(tempdir, 'output.yml')
         compiler.write_pipeline_spec_to_file(self.pipeline_spec,
                                              temp_filepath)
         actual = pipeline_spec_from_file(temp_filepath)
     self.assertEqual(actual, self.pipeline_spec)
Ejemplo n.º 2
0
 def test_json(self):
     with tempfile.TemporaryDirectory() as tempdir, self.assertWarnsRegex(
             DeprecationWarning, r'Compiling to JSON is deprecated'):
         temp_filepath = os.path.join(tempdir, 'output.json')
         compiler.write_pipeline_spec_to_file(self.pipeline_spec,
                                              temp_filepath)
         actual = pipeline_spec_from_file(temp_filepath)
     self.assertEqual(actual, self.pipeline_spec)
Ejemplo n.º 3
0
    def save_to_component_yaml(self, output_file: str) -> None:
        """Saves ComponentSpec into IR YAML file.

        Args:
            output_file: File path to store the component yaml.
        """

        pipeline_spec = self.to_pipeline_spec()
        compiler.write_pipeline_spec_to_file(pipeline_spec, output_file)
Ejemplo n.º 4
0
 def test_incorrect_extension(self):
     with tempfile.TemporaryDirectory() as tempdir, self.assertRaisesRegex(
             ValueError, r'should end with "\.yaml"\.'):
         temp_filepath = os.path.join(tempdir, 'output.txt')
         compiler.write_pipeline_spec_to_file(self.pipeline_spec,
                                              temp_filepath)