Esempio n. 1
0
 def observed_from_string(self, observer):
     initial_dict = {"foo": "bar", "foobar": {"baz": "fob"}}
     return observed_dict.UpdateObserverDict(
         initial_yaml_string=self.as_yaml(initial_dict),
         name="test_2",
         observer=observer,
     )
Esempio n. 2
0
 def test_value_error_on_initialising(self):
     initial_dict = {'foo': 'bar', 'foobar': {'baz': 'fob'}}
     initial_string = self.as_yaml(initial_dict)
     with pytest.raises(ValueError) as error:
         observed_dict.UpdateObserverDict(name='test_2',
                                          observer=xr.Dataset())
     assert check_error_or_warning(
         error,
         'must supply one, and only one, of initial_dict or initial_yaml_string'
     )
     with pytest.raises(ValueError) as error:
         observed_dict.UpdateObserverDict(
             initial_yaml_string=initial_string,
             initial_dict=initial_dict,
             name='test_2',
             observer=xr.Dataset())
     assert check_error_or_warning(
         error,
         'must supply one, and only one, of initial_dict or initial_yaml_string'
     )
Esempio n. 3
0
 def test_value_error_on_initialising(self):
     initial_dict = {"foo": "bar", "foobar": {"baz": "fob"}}
     initial_string = self.as_yaml(initial_dict)
     with pytest.raises(ValueError) as error:
         observed_dict.UpdateObserverDict(name="test_2", observer=xr.Dataset())
     assert check_error_or_warning(
         error,
         "must supply one, and only one, of initial_dict or initial_yaml_string",
     )
     with pytest.raises(ValueError) as error:
         observed_dict.UpdateObserverDict(
             initial_yaml_string=initial_string,
             initial_dict=initial_dict,
             name="test_2",
             observer=xr.Dataset(),
         )
     assert check_error_or_warning(
         error,
         "must supply one, and only one, of initial_dict or initial_yaml_string",
     )
Esempio n. 4
0
 def observed_from_dict(self, observer):
     initial_dict = {"foo": "bar", "foobar": {"baz": "fob"}}
     return observed_dict.UpdateObserverDict(initial_dict=initial_dict,
                                             name="test",
                                             observer=observer)
Esempio n. 5
0
 def observed_from_string(self, observer):
     initial_dict = {'foo': 'bar', 'foobar': {'baz': 'fob'}}
     return observed_dict.UpdateObserverDict(
         initial_yaml_string=self.as_yaml(initial_dict),
         name='test_2',
         observer=observer)
Esempio n. 6
0
 def observed_from_dict(self, observer):
     initial_dict = {'foo': 'bar', 'foobar': {'baz': 'fob'}}
     return observed_dict.UpdateObserverDict(initial_dict=initial_dict,
                                             name='test',
                                             observer=observer)