Exemple #1
0
 def test_shallow_encoding(self):
     expected_json = dedent("""
         {
           "name": "bob",
           "type_alias": "pants.engine.internals.parsers_test.Bob",
           "friend": {
             "name": "bill",
             "type_alias": "pants.engine.internals.parsers_test.Bob"
           },
           "relative": "::an opaque address::"
         }
         """).strip()
     self.assertEqual(
         json.dumps(json.loads(expected_json), sort_keys=True),
         parsers.encode_json(self.bob, inline=False, sort_keys=True),
     )
Exemple #2
0
 def round_trip(self, obj, symbol_table=None):
     document = parsers.encode_json(obj, inline=True)
     return self.parse(document, symbol_table=symbol_table)