def test_key_only(self): definition = "{Shot}" template_string = TemplateString(definition, self.keys) input_string = "shot_1" expected = {"Shot": "shot_1"} result = template_string.get_fields(input_string) self.assertEquals(expected, result)
def test_key_only(self): definition = "{Shot}" template_string = TemplateString(definition, self.keys) input_string = "shot_1" expected = {"Shot": "shot_1"} result = template_string.get_fields(input_string) self.assertEqual(expected, result)
def test_key_first(self): definition = "{Shot}.{Sequence}" template_string = TemplateString(definition, self.keys) input_string = "shot_1.Seq_12" expected = {"Shot": "shot_1", "Sequence": "Seq_12"} result = template_string.get_fields(input_string) self.assertEqual(expected, result)
def test_key_first(self): definition = "{Shot}.{Sequence}" template_string = TemplateString(definition, self.keys) input_string = "shot_1.Seq_12" expected = {"Shot": "shot_1", "Sequence": "Seq_12"} result = template_string.get_fields(input_string) self.assertEquals(expected, result)
def test_optional_values(self): """ Test definition containing optional sections resolves correctly. """ template_string = TemplateString("something-{Shot}[.{Sequence}]", self.keys) input_string = "something-shot_1.seq_2" expected = {"Shot": "shot_1", "Sequence": "seq_2"} result = template_string.get_fields(input_string) self.assertEqual(expected, result) # without optional value input_string = "something-shot_1" expected = {"Shot": "shot_1"} result = template_string.get_fields(input_string) self.assertEqual(expected, result)
def test_optional_values(self): """ Test definition containing optional sections resolves correctly. """ template_string = TemplateString("something-{Shot}[.{Sequence}]", self.keys) input_string = "something-shot_1.seq_2" expected = {"Shot": "shot_1", "Sequence": "seq_2"} result = template_string.get_fields(input_string) self.assertEquals(expected, result) # without optional value input_string = "something-shot_1" expected = {"Shot": "shot_1"} result = template_string.get_fields(input_string) self.assertEquals(expected, result)