Esempio n. 1
0
    def test_get_slot_values(self):
        t1 = Template(
            [self.a, self.slot_x, self.a, self.slot_y, self.a, self.slot_z])
        t2 = Template([self.a, self.b, self.a, self.b, self.a, self.b])
        t3 = Template([self.a, self.c, self.a, self.b, self.a, self.c])
        tc = Template([self.a, self.c, self.a, self.c, self.a, self.c])
        ta = Template([self.a, self.a, self.a, self.a, self.a, self.a])

        self.assertEqual(
            {
                self.slot_x: {self.bt},
                self.slot_y: {self.bt},
                self.slot_z: {self.bt}
            },
            t1.get_slot_values([t2]),
        )

        self.assertEqual(
            {
                self.slot_x: {self.bt, self.ct},
                self.slot_y: {self.bt},
                self.slot_z: {self.bt, self.ct},
            },
            t1.get_slot_values([t2, t3]),
        )
        self.assertEqual(
            {
                self.slot_x: {self.bt, self.ct},
                self.slot_y: {self.bt, self.ct},
                self.slot_z: {self.bt, self.ct},
            },
            t1.get_slot_values([t2, t3, tc]),
        )
        self.assertEqual(
            {
                self.slot_x: {self.at, self.bt, self.ct},
                self.slot_y: {self.at, self.bt, self.ct},
                self.slot_z: {self.at, self.bt, self.ct},
            },
            t1.get_slot_values([t2, t3, tc, ta]),
        )
        self.assertEqual(
            {
                self.slot_x: {self.at, self.ct},
                self.slot_y: {self.at, self.ct},
                self.slot_z: {self.at, self.ct},
            },
            t1.get_slot_values([tc, ta]),
        )
Esempio n. 2
0
    def test_get_slot_values_same_slot_name(self):
        t1 = Template([self.a, self.slot_x, self.a, self.slot_y, self.a, self.slot_x])
        t2 = Template([self.a, self.b, self.a, self.b, self.a, self.c])

        self.assertEqual(
            {self.slot_x: {self.bt, self.ct}, self.slot_y: {self.bt}},
            t1.get_slot_values([t2]),
        )