def test_sample_set_field(self):
        """Tests that when a field is added to the dataset schema via implicit
        adding on a sample, that change is reflected in the dataset.
        """
        dataset = fo.Dataset()
        sample = fo.Sample(filepath="test1.png")
        dataset.add_sample(sample)

        field_name = "field1"
        ftype = fo.IntField
        value = 51

        # field not in schema
        with self.assertRaises(KeyError):
            fields = dataset.get_field_schema()
            fields[field_name]

        # added to sample
        sample[field_name] = value
        fields = dataset.get_field_schema()
        self.assertIsInstance(fields[field_name], ftype)
Tests that when a field is added to the dataset schema via implicit
        adding on a sample, that change is reflected in the dataset.
        
tests/unittests/synchronization_tests.py