1import json 2import unittest 3 4from proto import pricetag_pb2 5 6 7class TestCase(unittest.TestCase): 8 def test_pricetag(self): 9 got = pricetag_pb2.PriceTag( 10 name="dollar", 11 cost=5.00, 12 ) 13 14 metadata = {"description": "some text..."} 15 got.metadata.value = json.dumps(metadata).encode("utf-8") 16 17 self.assertIsNotNone(got) 18 19 20if __name__ == "__main__": 21 unittest.main() 22