コード例 #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)