Esempio n. 1
0
    def testSubFieldNames(self):
        """Check the syntax of the names list components.
        """

        common.verbosePrint('\nTesting names list decomposition')
        subnames = [sn for sn in nriterators.getSubNames(self.names)]
        self.assertEqual(subnames, self.subnames)
Esempio n. 2
0
    def testSubFieldNames(self):
        """Check the syntax of the names list components.
        """

        common.verbosePrint('\nTesting names list decomposition')
        subnames = [sn for sn in nriterators.getSubNames(self.names)]
        self.assertEqual(subnames, self.subnames)
Esempio n. 3
0
def _checkNames(names):
    """
    Check the format of the `names` list.

    For an explanation of argument meanings see the `array()` function.
    """

    # Names description must be a list or a tuple
    if not (isinstance(names, list) or isinstance(names, tuple)):
        raise TypeError("""``names`` argument must be a list""")

    # Names elements must be strings or 2-tuples
    # (flattenNames will issue a TypeError in case this is not true)
    nriterators.flattenNames(names)

    # The names used in the names list should not contain the '/' string
    for item in nriterators.getSubNames(names):
        if "/" in item:
            raise ValueError("""field names cannot contain the ``/`` character""")

    # For every level of the names structure names must be unique
    nriterators.checkNamesUniqueness(names)
Esempio n. 4
0
def _checkNames(names):
    """
    Check the format of the `names` list.

    For an explanation of argument meanings see the `array()` function.
    """

    # Names description must be a list or a tuple
    if not (isinstance(names, list) or isinstance(names, tuple)):
        raise TypeError("""``names`` argument must be a list""")

    # Names elements must be strings or 2-tuples
    # (flattenNames will issue a TypeError in case this is not true)
    colnames = nriterators.flattenNames(names)

    # The names used in the names list should not contain the '/' string
    for item in nriterators.getSubNames(names):
        if '/' in item:
            raise ValueError(
                """field names cannot contain the ``/`` character""")

    # For every level of the names structure names must be unique
    nriterators.checkNamesUniqueness(names)