Skip to content

Instantly share code, notes, and snippets.

@masouduut94
Last active July 10, 2020 07:41
Show Gist options
  • Save masouduut94/345d456d4e7f1e29cc3954aa05e43d98 to your computer and use it in GitHub Desktop.
Save masouduut94/345d456d4e7f1e29cc3954aa05e43d98 to your computer and use it in GitHub Desktop.
def test_add_frame(self):
frames_ids = [1, 2, 3, 4, 5]
self.json_parser.set_top_k(0)
for frame_id in frames_ids:
self.json_parser.add_frame(frame_id)
output = self.json_parser.output()
output_ids = [frame['frame_id'] for frame in output['frames']]
for frame_id in frames_ids:
self.assertIn(frame_id, output_ids)
# if repeated frame id was inserted, raise ValueError
with self.assertRaisesRegex(ValueError, "Frame id: (.*?) already exists"):
self.json_parser.add_frame(frames_ids[1])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment