Ejemplo n.º 1
0
    def test_empty(self):
        """
        An edge case

        Checks if an empty list stays empty.
        """

        l = scan._fill_endpoints([], 'a')
        self.assertEqual(l, [])
    def test_empty(self):

        """
        An edge case

        Checks if an empty list stays empty.
        """

        l = scan._fill_endpoints([], 'a')
        self.assertEqual(l, [])
Ejemplo n.º 3
0
    def test_single_tuple(self):
        """
        An edge case

        Checks whether a single tuple does not change.
        """

        l1 = [(1, 'a')]
        l2 = scan._fill_endpoints(l1, 'b')
        self.assertEqual(l1, l2)
Ejemplo n.º 4
0
    def test_single_element(self):
        """
        An edge case

        Checks whether a list with a single element does not break
        the function.
        """

        l = scan._fill_endpoints([1], 'a')
        self.assertEqual(l, [(1, 'a')])
Ejemplo n.º 5
0
    def test_no_fill(self):
        """
        A normal use case.

        Check whether a fully filled list does not get overwritten.
        """

        l1 = zip(xrange(10), itertools.repeat('a'))
        l2 = scan._fill_endpoints(l1, 'a')
        self.assertEqual(l1, l2)
    def test_single_tuple(self):

        """
        An edge case

        Checks whether a single tuple does not change.
        """

        l1 = [(1, 'a')]
        l2 = scan._fill_endpoints(l1, 'b')
        self.assertEqual(l1, l2)
    def test_single_element(self):

        """
        An edge case

        Checks whether a list with a single element does not break
        the function.
        """

        l = scan._fill_endpoints([1], 'a')
        self.assertEqual(l, [(1, 'a')])
    def test_no_fill(self):

        """
        A normal use case.

        Check whether a fully filled list does not get overwritten.
        """

        l1 = zip(xrange(10), itertools.repeat('a'))
        l2 = scan._fill_endpoints(l1, 'a')
        self.assertEqual(l1, l2)
Ejemplo n.º 9
0
    def test_all_fill(self):
        """
        A normal use case

        Checks if a list without ports is properly filled.
        """

        l1 = range(10)
        l2 = scan._fill_endpoints(l1, 'a')
        for e1, e2 in itertools.izip(l1, l2):
            self.assertEqual(e2, (e1, 'a'))
    def test_all_fill(self):

        """
        A normal use case

        Checks if a list without ports is properly filled.
        """

        l1 = range(10)
        l2 = scan._fill_endpoints(l1, 'a')
        for e1, e2 in itertools.izip(l1, l2):
            self.assertEqual(e2, (e1, 'a'))
Ejemplo n.º 11
0
    def test_mixed(self):
        """
        A normal use case

        Checks if only the desired parts of a list are filled.
        """

        l1 = ['a', ('b1', 'b2')]
        for i in xrange(10):
            l1.append(random.choice([i, (i, i)]))
        l2 = scan._fill_endpoints(l1, 'c')
        for e1, e2 in itertools.izip(l1, l2):
            if isinstance(e1, tuple):
                self.assertEqual(e1, e2)
            else:
                self.assertEqual(e2, (e1, 'c'))
    def test_mixed(self):

        """
        A normal use case

        Checks if only the desired parts of a list are filled.
        """

        l1 = ['a', ('b1', 'b2')]
        for i in xrange(10):
            l1.append(random.choice([i, (i, i)]))
        l2 = scan._fill_endpoints(l1, 'c')
        for e1, e2 in itertools.izip(l1, l2):
            if isinstance(e1, tuple):
                self.assertEqual(e1, e2)
            else:
                self.assertEqual(e2, (e1, 'c'))