Ejemplo n.º 1
0
    def setUp(self):
        self.element1 = Mock()
        self.element2 = Mock()
        self.element3 = Mock()

        self.elements = [self.element1, self.element2, self.element3]

        self.smartset = SmartElementSet("*", self.elements)
Ejemplo n.º 2
0
class SmartElementSetTest(unittest.TestCase):
    def setUp(self):
        self.element1 = Mock()
        self.element2 = Mock()
        self.element3 = Mock()

        self.elements = [self.element1, self.element2, self.element3]

        self.smartset = SmartElementSet("*", self.elements)

    def test_always_delegate_calls_to_first_element(self):
        self.smartset.click()

        self.element1.click.assert_called_with()

    def test_length(self):
        expect(len(self.smartset)) == 3

    def test_indexing(self):
        expect(self.smartset[0]) == self.element1
        expect(self.smartset[1]) == self.element2
        expect(self.smartset[2]) == self.element3