12Test serialization of JSON objects.
23class TestJsonSerialize(unittest.TestCase):
25 Test serialization of JSON objects.
27 This is usually done
as follows:
32 4. Check that extracted information
is correct
35 def test_serialize_comparison(self):
46 compared_revisions=revs,
58 js_decode = json.loads(js)
60 self.assertEqual(1, len(js_decode[
"packages"]))
61 self.assertEqual(
"arun_run1_run2", js_decode[
"label"])
62 self.assertEqual(
"pack1", js_decode[
"packages"][0][
"name"])
64 def test_serialize_revision_nested(self):
70 js_decode = json.loads(js)
72 self.assertEqual(2, len(js_decode[
"revisions"]))
73 self.assertEqual(
"label1", js_decode[
"revisions"][0][
"label"])
74 self.assertEqual(
"label2", js_decode[
"revisions"][1][
"label"])
76 def test_comparison_plot_file(self):
78 title=
"title", package=
"package", rootfile=
"rootfile"
82 self.assertEqual(ccp1.title,
"title")
83 self.assertEqual(ccp1.package,
"package")
85 self.assertEqual(ccp2.title,
"title")
86 self.assertEqual(ccp2.package,
"package")
89if __name__ ==
"__main__":