Exemplo n.º 1
0
 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)
Exemplo n.º 2
0
 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)
Exemplo n.º 3
0
 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)
Exemplo n.º 4
0
 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)
Exemplo n.º 5
0
    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)
Exemplo n.º 6
0
    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)