コード例 #1
0
 def test_init_existing(self):
     """Verify an existing file is read."""
     with patch('yorm.common.read_text', Mock(return_value="abc: 123")):
         sample = utilities.sync(self.Sample(), "sample.yml")
     assert 123 == sample.abc
コード例 #2
0
 def test_with_attrs(self):
     """Verify mapping can be enabled with with attributes."""
     attrs = {'var1': MockConverter}
     sample = utilities.sync(self.Sample(), "sample.yml", attrs)
     assert "sample.yml" == sample.yorm_mapper.path
     assert {'var1': MockConverter} == sample.yorm_mapper.attrs
コード例 #3
0
 def test_multiple(self):
     """Verify mapping cannot be enabled twice."""
     sample = utilities.sync(self.Sample(), "sample.yml")
     with pytest.raises(common.UseageError):
         utilities.sync(sample, "sample.yml")
コード例 #4
0
 def test_no_attrs(self):
     """Verify mapping can be enabled with no attributes."""
     sample = utilities.sync(self.Sample(), "sample.yml")
     assert "sample.yml" == sample.yorm_mapper.path
     assert {} == sample.yorm_mapper.attrs
コード例 #5
0
ファイル: test_utilities.py プロジェクト: gitter-badger/yorm
 def test_init_existing(self):
     """Verify an existing file is read."""
     with patch('yorm.common.read_text', Mock(return_value="abc: 123")):
         sample = utilities.sync(self.Sample(), "sample.yml")
     assert 123 == sample.abc
コード例 #6
0
ファイル: test_utilities.py プロジェクト: gitter-badger/yorm
 def test_multiple(self):
     """Verify mapping cannot be enabled twice."""
     sample = utilities.sync(self.Sample(), "sample.yml")
     with pytest.raises(common.UseageError):
         utilities.sync(sample, "sample.yml")
コード例 #7
0
ファイル: test_utilities.py プロジェクト: gitter-badger/yorm
 def test_with_attrs(self):
     """Verify mapping can be enabled with with attributes."""
     attrs = {'var1': MockConverter}
     sample = utilities.sync(self.Sample(), "sample.yml", attrs)
     assert "sample.yml" == sample.yorm_mapper.path
     assert {'var1': MockConverter} == sample.yorm_mapper.attrs
コード例 #8
0
ファイル: test_utilities.py プロジェクト: gitter-badger/yorm
 def test_no_attrs(self):
     """Verify mapping can be enabled with no attributes."""
     sample = utilities.sync(self.Sample(), "sample.yml")
     assert "sample.yml" == sample.yorm_mapper.path
     assert {} == sample.yorm_mapper.attrs