# Path: tt/definitions/operands.py
# def is_valid_identifier(identifier_name):
#     """Returns whether the string is a valid symbol identifier.
# 
#     Valid identifiers are those that follow Python variable naming conventions,
#     are not Python keywords, and do not begin with an underscore.
# 
#     :param identifier_name: The string to test.
#     :type identifier_name: :class:`str <python:str>`
# 
#     :returns: True if the passed string is valid identifier, otherwise False.
#     :rtype: :class:`bool <python:bool>`
# 
#     :raises InvalidArgumentTypeError: If ``identifier_name`` is not a string.
#     :raises InvalidArgumentValueError: If ``identifier_name`` is an empty
#         string.
# 
#     As an example::
# 
#         >>> from tt import is_valid_identifier
#         >>> is_valid_identifier('$var')
#         False
#         >>> is_valid_identifier('va#r')
#         False
#         >>> is_valid_identifier('for')
#         False
#         >>> is_valid_identifier('False')
#         False
#         >>> is_valid_identifier('var')
#         True
#         >>> is_valid_identifier('')
#         Traceback (most recent call last):
#             ...
#         tt.errors.arguments.InvalidArgumentValueError: identifier_name cannot \
# be empty
#         >>> is_valid_identifier(None)
#         Traceback (most recent call last):
#             ...
#         tt.errors.arguments.InvalidArgumentTypeError: identifier_name must be \
# a string
# 
#     """
#     if not isinstance(identifier_name, str):
#         raise InvalidArgumentTypeError('identifier_name must be a string')
# 
#     if not identifier_name:
#         raise InvalidArgumentValueError('identifier_name cannot be empty')
# 
#     if identifier_name.startswith('_'):
#         return False
# 
#     if identifier_name in _tt_keywords:
#         return False
# 
#     identifier_re = re.compile(r'^[^\d\W]\w*\Z', re.UNICODE)
#     if re.match(identifier_re, identifier_name) is None:
#         return False
# 
#     return True
# 
# Path: tt/errors/arguments.py
# class InvalidArgumentTypeError(ArgumentError):
#     """An exception type for invalid argument types.
# 
#     To illustrate this error type, let's try passing an invalid argument when
#     creating a :class:`TruthTable <tt.tables.truth_table.TruthTable>`::
# 
#         >>> from tt import TruthTable
#         >>> t = TruthTable(7)
#         Traceback (most recent call last):
#             ...
#         tt.errors.arguments.InvalidArgumentTypeError: Arg `expr` must be of \
# type `str` or `BooleanExpression`
# 
#     """
# 
# class InvalidArgumentValueError(ArgumentError):
#     """An exception type for invalid argument values.
# 
#     Here's an example where we pass a non-power of 2 number of values when
#     attempting to create a :class:`TruthTable \
#     <tt.tables.truth_table.TruthTable>`::
# 
#         >>> from tt import TruthTable
#         >>> t = TruthTable(from_values='01x')
#         Traceback (most recent call last):
#             ...
#         tt.errors.arguments.InvalidArgumentValueError: Must specify a number \
# of input values that is a power of 2
# 
#     """


import unittest
from tt.definitions import is_valid_identifier
from tt.errors import (
    InvalidArgumentTypeError,
    InvalidArgumentValueError)
        self.assertFalse(is_valid_identifier('9var'))
        self.assertFalse(is_valid_identifier('10var'))

        self.assertTrue(is_valid_identifier('v9ar'))
        self.assertTrue(is_valid_identifier('var12345'))

    def test_invalid_symbols(self):
        """Test invalid identifier containing bad symbols."""
        self.assertFalse(is_valid_identifier('#'))
        self.assertFalse(is_valid_identifier('!v!a!r!'))
        self.assertFalse(is_valid_identifier('var@'))
        self.assertFalse(is_valid_identifier('v(a)r'))
        self.assertFalse(is_valid_identifier('v``ar'))

    def test_underscores(self):
        """Test identifiers with underscores."""
        self.assertFalse(is_valid_identifier('_var'))
        self.assertFalse(is_valid_identifier('___var'))

        self.assertTrue(is_valid_identifier('va_r'))
        self.assertTrue(is_valid_identifier('var_'))

    def test_valid_identifiers(self):
        """Test a few valid identifiers."""
        self.assertTrue(is_valid_identifier('var11'))
        self.assertTrue(is_valid_identifier('var_20'))
        self.assertTrue(is_valid_identifier('variable'))

    def test_empty_str(self):
        """Test that an empty string raises an error."""

# Path: tt/definitions/operands.py
# def is_valid_identifier(identifier_name):
#     """Returns whether the string is a valid symbol identifier.
# 
#     Valid identifiers are those that follow Python variable naming conventions,
#     are not Python keywords, and do not begin with an underscore.
# 
#     :param identifier_name: The string to test.
#     :type identifier_name: :class:`str <python:str>`
# 
#     :returns: True if the passed string is valid identifier, otherwise False.
#     :rtype: :class:`bool <python:bool>`
# 
#     :raises InvalidArgumentTypeError: If ``identifier_name`` is not a string.
#     :raises InvalidArgumentValueError: If ``identifier_name`` is an empty
#         string.
# 
#     As an example::
# 
#         >>> from tt import is_valid_identifier
#         >>> is_valid_identifier('$var')
#         False
#         >>> is_valid_identifier('va#r')
#         False
#         >>> is_valid_identifier('for')
#         False
#         >>> is_valid_identifier('False')
#         False
#         >>> is_valid_identifier('var')
#         True
#         >>> is_valid_identifier('')
#         Traceback (most recent call last):
#             ...
#         tt.errors.arguments.InvalidArgumentValueError: identifier_name cannot \
# be empty
#         >>> is_valid_identifier(None)
#         Traceback (most recent call last):
#             ...
#         tt.errors.arguments.InvalidArgumentTypeError: identifier_name must be \
# a string
# 
#     """
#     if not isinstance(identifier_name, str):
#         raise InvalidArgumentTypeError('identifier_name must be a string')
# 
#     if not identifier_name:
#         raise InvalidArgumentValueError('identifier_name cannot be empty')
# 
#     if identifier_name.startswith('_'):
#         return False
# 
#     if identifier_name in _tt_keywords:
#         return False
# 
#     identifier_re = re.compile(r'^[^\d\W]\w*\Z', re.UNICODE)
#     if re.match(identifier_re, identifier_name) is None:
#         return False
# 
#     return True
# 
# Path: tt/errors/arguments.py
# class InvalidArgumentTypeError(ArgumentError):
#     """An exception type for invalid argument types.
# 
#     To illustrate this error type, let's try passing an invalid argument when
#     creating a :class:`TruthTable <tt.tables.truth_table.TruthTable>`::
# 
#         >>> from tt import TruthTable
#         >>> t = TruthTable(7)
#         Traceback (most recent call last):
#             ...
#         tt.errors.arguments.InvalidArgumentTypeError: Arg `expr` must be of \
# type `str` or `BooleanExpression`
# 
#     """
# 
# class InvalidArgumentValueError(ArgumentError):
#     """An exception type for invalid argument values.
# 
#     Here's an example where we pass a non-power of 2 number of values when
#     attempting to create a :class:`TruthTable \
#     <tt.tables.truth_table.TruthTable>`::
# 
#         >>> from tt import TruthTable
#         >>> t = TruthTable(from_values='01x')
#         Traceback (most recent call last):
#             ...
#         tt.errors.arguments.InvalidArgumentValueError: Must specify a number \
# of input values that is a power of 2
# 
#     """


# Path: tt/tests/unit/definitions/test_is_valid_identifier.py
import unittest
from tt.definitions import is_valid_identifier
from tt.errors import (
    InvalidArgumentTypeError,
    InvalidArgumentValueError)

        self.assertFalse(is_valid_identifier('9var'))
        self.assertFalse(is_valid_identifier('10var'))

        self.assertTrue(is_valid_identifier('v9ar'))
        self.assertTrue(is_valid_identifier('var12345'))

    def test_invalid_symbols(self):
        """Test invalid identifier containing bad symbols."""
        self.assertFalse(is_valid_identifier('#'))
        self.assertFalse(is_valid_identifier('!v!a!r!'))
        self.assertFalse(is_valid_identifier('var@'))
        self.assertFalse(is_valid_identifier('v(a)r'))
        self.assertFalse(is_valid_identifier('v``ar'))

    def test_underscores(self):
        """Test identifiers with underscores."""
        self.assertFalse(is_valid_identifier('_var'))
        self.assertFalse(is_valid_identifier('___var'))

        self.assertTrue(is_valid_identifier('va_r'))
        self.assertTrue(is_valid_identifier('var_'))

    def test_valid_identifiers(self):
        """Test a few valid identifiers."""
        self.assertTrue(is_valid_identifier('var11'))
        self.assertTrue(is_valid_identifier('var_20'))
        self.assertTrue(is_valid_identifier('variable'))

    def test_empty_str(self):
        """Test that an empty string raises an error."""

        with self.assertRaises(InvalidArgumentValueError):