def test_f2g(self):
     g_f = eg_simple_flat()
     g_g = eg_simple_grouped()
     g_f2g = group_flat_containers(g_f)
     self.assertEqual(g_f2g, g_g)
Exemple #2
0
"""
Example code demonstrating simple semantic containers 'grouping' operation.

"""
from ncobj.cdl import cdl

import ncobj.examples.simple_semantic_containers as egs


g = egs.eg_simple_flat()
g_cdl = cdl(g)

print
print '----------------'
print 'Original flat version:'
print '----------------'
print g_cdl
print '----------------'

g_grouped = egs.group_flat_containers(g)
g_grouped_cdl = cdl(g_grouped)
print
print '----------------'
print 'Result, grouped from flat form:'
print '----------------'
print g_grouped_cdl
print '----------------'

g_grouped_eg = egs.eg_simple_grouped()
print
print 'Result matches grouped-form reference : ', g_grouped == g_grouped_eg
 def test_g2f(self):
     g_f = eg_simple_flat()
     g_g = eg_simple_grouped()
     g_g2f = flatten_grouped_containers(g_g)
     self.assertEqual(g_g2f, g_f)