Пример #1
0
 def test_attr_transformation_fail(self):
     attrs = _Attrs('test', {'number': 'abc'}, {'count': ('number', int)})
     self.assertRaises(ValueError, lambda: attrs.count)
Пример #2
0
 def test_raises_on_missing_required_attribute(self):
     attrs = _Attrs('test', {}, {'name': 'node-name'})
     self.assertRaises(AttributeError, lambda: attrs.name)
Пример #3
0
 def test_attr_transformation_success(self):
     attrs = _Attrs('test', {'number': '7'}, {'count': ('number', int)})
     self.assertEqual(7, attrs.count)
Пример #4
0
 def test_get_declared_attr(self):
     attrs = _Attrs('test', {'node-name': 'node1'}, {'name': 'node-name'})
     self.assertEqual('node1', attrs.name)
Пример #5
0
 def test_raises_on_undeclared_attribute(self):
     attrs = _Attrs('test', {'node-name': 'node1'}, {})
     self.assertRaises(AttributeError, lambda: attrs.name)
Пример #6
0
 def test_attr_transformation_fail(self):
     attrs = _Attrs('test', {'number': 'abc'}, {'count': ('number', int)})
     self.assertRaises(ValueError, lambda: attrs.count)
Пример #7
0
 def test_attr_transformation_success(self):
     attrs = _Attrs('test', {'number': '7'}, {'count': ('number', int)})
     self.assertEqual(7, attrs.count)
Пример #8
0
 def test_raises_on_missing_required_attribute(self):
     attrs = _Attrs('test', {}, {'name': 'node-name'})
     self.assertRaises(AttributeError, lambda: attrs.name)
Пример #9
0
 def test_raises_on_undeclared_attribute(self):
     attrs = _Attrs('test', {'node-name': 'node1'}, {})
     self.assertRaises(AttributeError, lambda: attrs.name)
Пример #10
0
 def test_get_declared_attr(self):
     attrs = _Attrs('test', {'node-name': 'node1'}, {'name': 'node-name'})
     self.assertEqual('node1', attrs.name)