Signed-off-by: YAMAMOTO Takashi <[email protected]>
---
 ryu/tests/unit/ofproto/test_parser.py | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

diff --git a/ryu/tests/unit/ofproto/test_parser.py 
b/ryu/tests/unit/ofproto/test_parser.py
index 4cf5641..6ad64c0 100644
--- a/ryu/tests/unit/ofproto/test_parser.py
+++ b/ryu/tests/unit/ofproto/test_parser.py
@@ -159,6 +159,26 @@ class Test_Parser(unittest.TestCase):
             eq_(self._msg_to_jsondict(msg2), json_dict)
             eq_(wire_msg, msg2.buf)
 
+            # check if "len" "length" fields can be omitted
+
+            def _remove(d, names):
+                f = lambda x: _remove(x, names)
+                if isinstance(d, list):
+                    return map(f, d)
+                if isinstance(d, dict):
+                    d2 = {}
+                    for k, v in d.iteritems():
+                        if k in names:
+                            continue
+                        d2[k] = f(v)
+                    return d2
+                return d
+
+            json_dict3 = _remove(json_dict, ['len', 'length'])
+            msg3 = self._jsondict_to_msg(dp, json_dict3)
+            msg3.serialize()
+            eq_(wire_msg, msg3.buf)
+
 
 def _add_tests():
     import os
-- 
1.8.3.1


------------------------------------------------------------------------------
Learn the latest--Visual Studio 2012, SharePoint 2013, SQL 2012, more!
Discover the easy way to master current and previous Microsoft technologies
and advance your career. Get an incredible 1,500+ hours of step-by-step
tutorial videos with LearnDevNow. Subscribe today and save!
http://pubads.g.doubleclick.net/gampad/clk?id=58040911&iu=/4140/ostg.clktrk
_______________________________________________
Ryu-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ryu-devel

Reply via email to