BIND 10 trac1175, updated. ee6d95d9acf3957aa57949e34d17a12760878c14 [1175] fix wrong list-type handling in the function get_spec_defaults and add more tests into test_get_spec_defaults
BIND 10 source code commits
bind10-changes at lists.isc.org
Fri Aug 26 04:04:02 UTC 2011
The branch, trac1175 has been updated
via ee6d95d9acf3957aa57949e34d17a12760878c14 (commit)
from 36df7f4a05a2f07cdb6cddd80a476fa53fdb3bf9 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit ee6d95d9acf3957aa57949e34d17a12760878c14
Author: Naoki Kambe <kambe at jprs.co.jp>
Date: Fri Aug 26 12:01:47 2011 +0900
[1175] fix wrong list-type handling in the function get_spec_defaults and add
more tests into test_get_spec_defaults
-----------------------------------------------------------------------
Summary of changes:
src/bin/stats/stats.py.in | 2 +-
src/bin/stats/tests/b10-stats_test.py | 22 +++++++++++++---------
2 files changed, 14 insertions(+), 10 deletions(-)
-----------------------------------------------------------------------
diff --git a/src/bin/stats/stats.py.in b/src/bin/stats/stats.py.in
index d5cfaa3..77d4dd3 100644
--- a/src/bin/stats/stats.py.in
+++ b/src/bin/stats/stats.py.in
@@ -88,7 +88,7 @@ def get_spec_defaults(spec):
elif item_type == "list":
return spec.get(
"item_default",
- [ _get_spec_defaults(s) for s in spec["list_item_spec"] ])
+ [ _get_spec_defaults(spec["list_item_spec"]) ])
elif item_type == "map":
return spec.get(
"item_default",
diff --git a/src/bin/stats/tests/b10-stats_test.py b/src/bin/stats/tests/b10-stats_test.py
index 7817d29..892032d 100644
--- a/src/bin/stats/tests/b10-stats_test.py
+++ b/src/bin/stats/tests/b10-stats_test.py
@@ -43,9 +43,7 @@ class TestUtilties(unittest.TestCase):
{ 'item_name': 'test_bool1', 'item_type': 'boolean', 'item_default': True },
{ 'item_name': 'test_str1', 'item_type': 'string', 'item_default': 'ABCD' },
{ 'item_name': 'test_list1', 'item_type': 'list', 'item_default': [1,2,3],
- 'list_item_spec' : [ { 'item_name': 'one', 'item_type': 'integer' },
- { 'item_name': 'two', 'item_type': 'integer' },
- { 'item_name': 'three', 'item_type': 'integer' } ] },
+ 'list_item_spec' : { 'item_name': 'number', 'item_type': 'integer' } },
{ 'item_name': 'test_map1', 'item_type': 'map', 'item_default': {'a':1,'b':2,'c':3},
'map_item_spec' : [ { 'item_name': 'a', 'item_type': 'integer'},
{ 'item_name': 'b', 'item_type': 'integer'},
@@ -55,14 +53,18 @@ class TestUtilties(unittest.TestCase):
{ 'item_name': 'test_bool2', 'item_type': 'boolean' },
{ 'item_name': 'test_str2', 'item_type': 'string' },
{ 'item_name': 'test_list2', 'item_type': 'list',
- 'list_item_spec' : [ { 'item_name': 'one', 'item_type': 'integer' },
- { 'item_name': 'two', 'item_type': 'integer' },
- { 'item_name': 'three', 'item_type': 'integer' } ] },
+ 'list_item_spec' : { 'item_name': 'number', 'item_type': 'integer' } },
{ 'item_name': 'test_map2', 'item_type': 'map',
'map_item_spec' : [ { 'item_name': 'A', 'item_type': 'integer'},
{ 'item_name': 'B', 'item_type': 'integer'},
{ 'item_name': 'C', 'item_type': 'integer'} ] },
- { 'item_name': 'test_none', 'item_type': 'none' }
+ { 'item_name': 'test_none', 'item_type': 'none' },
+ { 'item_name': 'test_list3', 'item_type': 'list', 'item_default': ["one","two","three"],
+ 'list_item_spec' : { 'item_name': 'number', 'item_type': 'string' } },
+ { 'item_name': 'test_map3', 'item_type': 'map', 'item_default': {'a':'one','b':'two','c':'three'},
+ 'map_item_spec' : [ { 'item_name': 'a', 'item_type': 'string'},
+ { 'item_name': 'b', 'item_type': 'string'},
+ { 'item_name': 'c', 'item_type': 'string'} ] }
]
def setUp(self):
@@ -85,9 +87,11 @@ class TestUtilties(unittest.TestCase):
'test_real2' : 0.0,
'test_bool2' : False,
'test_str2' : "",
- 'test_list2' : [0,0,0],
+ 'test_list2' : [0],
'test_map2' : { 'A' : 0, 'B' : 0, 'C' : 0 },
- 'test_none' : None })
+ 'test_none' : None,
+ 'test_list3' : [ "one", "two", "three" ],
+ 'test_map3' : { 'a' : 'one', 'b' : 'two', 'c' : 'three' } })
self.assertEqual(stats.get_spec_defaults(None), {})
self.assertRaises(KeyError, stats.get_spec_defaults, [{'item_name':'Foo'}])
More information about the bind10-changes
mailing list