Ejemplo n.º 1
0
 def test_ordering(self):
     trail = Trail()
     marker_static_first = Marker(trail, 222).set_timestamp(TIMESTAMP)
     marker_static_first.add_static_params([333, 444])
     marker_static_first.add_variable_params(["test parameter", "other test parameter"])
     marker_static_first.set_instance_id(555)
     marker_variable_first = Marker(trail, 222).set_timestamp(TIMESTAMP)
     marker_variable_first.add_variable_params(["test parameter", "other test parameter"])
     marker_variable_first.set_instance_id(555)
     marker_variable_first.add_static_params([333, 444]).set_timestamp(TIMESTAMP)
     self.assertEqual(marker_static_first.serialize(), marker_variable_first.serialize())
     self.assertEqual(marker_static_first.serialize(), MARKER_STRING_ALL)
Ejemplo n.º 2
0
 def test_interfaces(self):
     trail = Trail()
     marker_constructor = Marker(
         trail,
         222,
         555,
         False,
         SCOPE_NONE,
         [333, 444],
         ["test parameter", "other test parameter"]).set_timestamp(TIMESTAMP)
     marker_plurals = Marker(trail, 222).set_timestamp(TIMESTAMP)
     marker_plurals.set_instance_id(555)
     marker_plurals.add_static_params([333, 444])
     marker_plurals.add_variable_params(["test parameter", "other test parameter"])
     marker_singles = Marker(trail, 222).set_timestamp(TIMESTAMP)
     marker_singles.set_instance_id(555)
     marker_singles.add_static_param(333).add_static_param(444)
     marker_singles.add_variable_param("test parameter")\
         .add_variable_param("other test parameter")
     self.assertEqual(marker_constructor.serialize(), marker_plurals.serialize())
     self.assertEqual(marker_constructor.serialize(), marker_singles.serialize())
     self.assertEqual(marker_constructor.serialize(), MARKER_STRING_ALL)
Ejemplo n.º 3
0
 def test_params_no_list(self):
     marker = Marker(Trail(), 222).set_timestamp(TIMESTAMP)
     with self.assertRaises(TypeError):
         marker.add_static_params(333)
     with self.assertRaises(TypeError):
         marker.add_variable_params("test parameter")
Ejemplo n.º 4
0
 def test_two_variable_params(self):
     marker = Marker(Trail(), 222).set_timestamp(TIMESTAMP)
     marker.add_variable_params(["test parameter", "other test parameter"])
     self.assertEqual(marker.serialize(), MARKER_STRING_TWO_VAR)
     # Now just check that __str__ doesn't throw
     self.assertGreater(len(str(marker)), 0)