예제 #1
0
def test_simple():
    result = Result()
    result.root['f1'] = 1
    a = result.root.setdefault('a', {})
    a['f2'] = 2
    b = result.index.setdefault('b', {})
    b[1] = {'f3': 'bar1'}
    b[2] = {'f3': 'bar2'}
    b[3] = {'f3': 'bar3'}
    result.root['l1'] = result.ref('b', 1)
    result.root['l2'] = [result.ref('b', 2), result.ref('b', 3)]
    check_writes(
        result,
        """
        {
          "f1" 1
          "a" {"f2" 2}
          "b" {1 {"f3" "bar1"}
               2 {"f3" "bar2"}
               3 {"f3" "bar3"}}
          "l1" #graph/ref ["b" 1]
          "l2" [#graph/ref ["b" 2]
                #graph/ref ["b" 3]]
        }
        """,
    )
예제 #2
0
 def testSimple(self):
     result = Result()
     result.root['f1'] = 1
     a = result.root.setdefault('a', {})
     a['f2'] = 2
     b = result.index.setdefault('b', {})
     b[1] = {'f3': 'bar1'}
     b[2] = {'f3': 'bar2'}
     b[3] = {'f3': 'bar3'}
     result.root['l1'] = result.ref('b', 1)
     result.root['l2'] = [result.ref('b', 2), result.ref('b', 3)]
     self.assertWrites(
         result,
         """
         {
           "f1" 1
           "a" {"f2" 2}
           "b" {1 {"f3" "bar1"}
                2 {"f3" "bar2"}
                3 {"f3" "bar3"}}
           "l1" #graph/ref ["b" 1]
           "l2" [#graph/ref ["b" 2]
                 #graph/ref ["b" 3]]
         }
         """,
     )
예제 #3
0
 def testSimple(self):
     result = Result()
     result['f1'] = 1
     result['a']['f2'] = 2
     result.idx['b'][1] = {'f3': 'bar1'}
     result.idx['b'][2] = {'f3': 'bar2'}
     result.idx['b'][3] = {'f3': 'bar3'}
     result['l1'] = result.ref('b', 1)
     result['l2'] = [result.ref('b', 2), result.ref('b', 3)]
     self.assertWrites(
         result,
         """
         {
           "f1": 1,
           "a": {"f2": 2},
           "l1": {"f3": "bar1"},
           "l2": [
             {"f3": "bar2"},
             {"f3": "bar3"}
           ]
         }
         """,
     )
예제 #4
0
 def testSimple(self):
     result = Result()
     result['f1'] = 1
     result['a']['f2'] = 2
     result.idx['b'][1] = {'f3': 'bar1'}
     result.idx['b'][2] = {'f3': 'bar2'}
     result.idx['b'][3] = {'f3': 'bar3'}
     result['l1'] = result.ref('b', 1)
     result['l2'] = [result.ref('b', 2), result.ref('b', 3)]
     self.assertWrites(
         result,
         """
         {
           :f1 1
           :a {:f2 2}
           :b {1 {:f3 "bar1"}
               2 {:f3 "bar2"}
               3 {:f3 "bar3"}}
           :l1 #graph/ref ["b" 1]
           :l2 [#graph/ref ["b" 2]
                #graph/ref ["b" 3]]
         }
         """,
     )
예제 #5
0
 def testSimple(self):
     result = Result()
     result['f1'] = 1
     result['a']['f2'] = 2
     result.idx['b'][1] = {'f3': 'bar1'}
     result.idx['b'][2] = {'f3': 'bar2'}
     result.idx['b'][3] = {'f3': 'bar3'}
     result['l1'] = result.ref('b', 1)
     result['l2'] = [result.ref('b', 2), result.ref('b', 3)]
     self.assertWrites(
         result,
         """
         {
           "f1": 1,
           "a": {"f2": 2},
           "l1": {"f3": "bar1"},
           "l2": [
             {"f3": "bar2"},
             {"f3": "bar3"}
           ]
         }
         """,
     )
예제 #6
0
 def testSimple(self):
     result = Result()
     result['f1'] = 1
     result['a']['f2'] = 2
     result.idx['b'][1] = {'f3': 'bar1'}
     result.idx['b'][2] = {'f3': 'bar2'}
     result.idx['b'][3] = {'f3': 'bar3'}
     result['l1'] = result.ref('b', 1)
     result['l2'] = [result.ref('b', 2), result.ref('b', 3)]
     self.assertWrites(
         result,
         """
         {
           :f1 1
           :a {:f2 2}
           :b {1 {:f3 "bar1"}
               2 {:f3 "bar2"}
               3 {:f3 "bar3"}}
           :l1 #graph/ref ["b" 1]
           :l2 [#graph/ref ["b" 2]
                #graph/ref ["b" 3]]
         }
         """,
     )
예제 #7
0
        Node('flossy', [
            Field('demoing', None, _),
            Field('anoxic', Optional[Record[{'peeps': String}]], _),
            Field('seggen', Record[{'pensive': String}], _),
            Field('necker', Sequence[Record[{'carney': String}]], _),
            Link('daur', TypeRef['cosies'], _, requires=None),
            Link('peafowl', Sequence[TypeRef['cosies']], _, requires=None),
            Link('carf', Optional[TypeRef['cosies']], _, requires=None,)
        ]),
        Link('zareeba', TypeRef['cosies'], _, requires=None),
        Link('crowdie', Sequence[TypeRef['cosies']], _, requires=None),
        Link('moujik', TypeRef['saunas'], _, requires=None),
    ]),
])

RESULT = Result()
RESULT.root.update({
    'slotted': 'quoy_ushered',
    'tatler': {'orudis': 'fhp_musterd'},
    'coom': {'yappers': 'idaho_golok'},
    'barbary': [{'betty': 'japheth_ophir'}],
    'flossy': {
        'demoing': 'judaea_bhutani',
        'anoxic': {'peeps': 'peterel_repave'},
        'seggen': {'pensive': 'quebec_junkman'},
        'necker': [{'carney': 'calla_pedway'}],
        'daur': RESULT.ref('cosies', 1),
        'peafowl': [RESULT.ref('cosies', 3),
                    RESULT.ref('cosies', 2)],
        'carf': None,
    },
예제 #8
0
            Link('daur', TypeRef['cosies'], _, requires=None),
            Link('peafowl', Sequence[TypeRef['cosies']], _, requires=None),
            Link(
                'carf',
                Optional[TypeRef['cosies']],
                _,
                requires=None,
            )
        ]),
        Link('zareeba', TypeRef['cosies'], _, requires=None),
        Link('crowdie', Sequence[TypeRef['cosies']], _, requires=None),
        Link('moujik', TypeRef['saunas'], _, requires=None),
    ]),
])

RESULT = Result()
RESULT.root.update({
    'slotted':
    'quoy_ushered',
    'tatler': {
        'orudis': 'fhp_musterd'
    },
    'coom': {
        'yappers': 'idaho_golok'
    },
    'barbary': [{
        'betty': 'japheth_ophir'
    }],
    'flossy': {
        'demoing': 'judaea_bhutani',
        'anoxic': {