# Path: can4python/exceptions.py
# class CanException(Exception):
# class CanTimeoutException(CanException):
# class CanNotFoundByKernelException(CanException):
# 
# Path: can4python/cansignal.py
# SYMBOL_LEAST_SIGNIFICANT_BIT = "L"
# SYMBOL_MOST_SIGNIFICANT_BIT = "M"
# SYMBOL_OTHER_VALID_BIT = "X"
#         MAX_COMMENT_LENGTH = 85
# class CanSignalDefinition():
#     def __init__(self, signalname, startbit, numberofbits, scalingfactor=1, valueoffset=0, defaultvalue=None,
#                  unit="", comment="", minvalue=None, maxvalue=None,
#                  endianness=constants.LITTLE_ENDIAN, signaltype=constants.CAN_SIGNALTYPE_UNSIGNED):
#     def endianness(self):
#     def endianness(self, value):
#     def signaltype(self):
#     def signaltype(self, value):
#     def scalingfactor(self):
#     def scalingfactor(self, value):
#     def valueoffset(self):
#     def valueoffset(self, value):
#     def startbit(self):
#     def startbit(self, value):
#     def defaultvalue(self):
#     def defaultvalue(self, value):
#     def minvalue(self):
#     def minvalue(self, value):
#     def maxvalue(self):
#     def maxvalue(self, value):
#     def numberofbits(self):
#     def numberofbits(self, value):
#     def __repr__(self):
#     def get_descriptive_ascii_art(self):
#     def get_maximum_possible_value(self):
#     def get_minimum_possible_value(self):
#     def get_minimum_dlc(self):
#     def _check_signal_value_range(self, attributename, value):
#     def _get_overview_string(self):
# 
# Path: can4python/canframe_definition.py
# class CanFrameDefinition():
#     def __init__(self, frame_id, name='', dlc=constants.MAX_NUMBER_OF_CAN_DATA_BYTES, cycletime=None,
#                  frame_format=constants.CAN_FRAMEFORMAT_STANDARD):
#     def __repr__(self, long_text=True):
#     def frame_id(self):
#     def frame_id(self, value):
#     def dlc(self):
#     def dlc(self, value):
#     def cycletime(self):
#     def cycletime(self, value):
#     def throttle_time(self):
#     def throttle_time(self, value):
#     def frame_format(self):
#     def frame_format(self, value):
#     def producer_ids(self):
#     def producer_ids(self, value):
#     def get_descriptive_ascii_art(self):
#     def get_signal_mask(self):
#     def is_outbound(self, ego_node_ids):


import sys
import unittest
from can4python import exceptions
from can4python import cansignal
from can4python import canframe_definition

        self.assertRaises(exceptions.CanException, setattr, self.frame_def, 'dlc', -1)
        self.assertRaises(exceptions.CanException, setattr, self.frame_def, 'dlc', 9)
        self.assertRaises(exceptions.CanException, setattr, self.frame_def, 'dlc', "1,0")
        self.assertRaises(exceptions.CanException, setattr, self.frame_def, 'frame_id', None)

        self.assertRaises(exceptions.CanException, setattr, self.frame_def, 'cycletime', -1)
        self.assertRaises(exceptions.CanException, setattr, self.frame_def, 'cycletime', "1,0")
        self.assertRaises(exceptions.CanException, setattr, self.frame_def, 'cycletime', 60001)

        self.assertRaises(exceptions.CanException, setattr, self.frame_def, 'throttle_time', -1)
        self.assertRaises(exceptions.CanException, setattr, self.frame_def, 'throttle_time', "1,0")
        self.assertRaises(exceptions.CanException, setattr, self.frame_def, 'throttle_time', 60001)

        self.assertRaises(exceptions.CanException, setattr, self.frame_def, 'frame_format', 'ABC')
        self.assertRaises(exceptions.CanException, setattr, self.frame_def, 'frame_format', None)
        self.assertRaises(exceptions.CanException, setattr, self.frame_def, 'frame_format', 1)

        self.assertRaises(exceptions.CanException, setattr, self.frame_def, 'producer_ids', 3)
        self.assertRaises(exceptions.CanException, setattr, self.frame_def, 'producer_ids', "3")

    def testIsOutbound(self):
        self.assertTrue(self.frame_def.is_outbound(["9"]))
        self.assertFalse(self.frame_def.is_outbound(["99"]))
        self.assertFalse(self.frame_def.is_outbound([9]))

    def testIsOutboundWrongType(self):
        self.assertRaises(exceptions.CanException, self.frame_def.is_outbound, 9)

    def testGetSignalMask(self):

# Path: can4python/exceptions.py
# class CanException(Exception):
# class CanTimeoutException(CanException):
# class CanNotFoundByKernelException(CanException):
# 
# Path: can4python/cansignal.py
# SYMBOL_LEAST_SIGNIFICANT_BIT = "L"
# SYMBOL_MOST_SIGNIFICANT_BIT = "M"
# SYMBOL_OTHER_VALID_BIT = "X"
#         MAX_COMMENT_LENGTH = 85
# class CanSignalDefinition():
#     def __init__(self, signalname, startbit, numberofbits, scalingfactor=1, valueoffset=0, defaultvalue=None,
#                  unit="", comment="", minvalue=None, maxvalue=None,
#                  endianness=constants.LITTLE_ENDIAN, signaltype=constants.CAN_SIGNALTYPE_UNSIGNED):
#     def endianness(self):
#     def endianness(self, value):
#     def signaltype(self):
#     def signaltype(self, value):
#     def scalingfactor(self):
#     def scalingfactor(self, value):
#     def valueoffset(self):
#     def valueoffset(self, value):
#     def startbit(self):
#     def startbit(self, value):
#     def defaultvalue(self):
#     def defaultvalue(self, value):
#     def minvalue(self):
#     def minvalue(self, value):
#     def maxvalue(self):
#     def maxvalue(self, value):
#     def numberofbits(self):
#     def numberofbits(self, value):
#     def __repr__(self):
#     def get_descriptive_ascii_art(self):
#     def get_maximum_possible_value(self):
#     def get_minimum_possible_value(self):
#     def get_minimum_dlc(self):
#     def _check_signal_value_range(self, attributename, value):
#     def _get_overview_string(self):
# 
# Path: can4python/canframe_definition.py
# class CanFrameDefinition():
#     def __init__(self, frame_id, name='', dlc=constants.MAX_NUMBER_OF_CAN_DATA_BYTES, cycletime=None,
#                  frame_format=constants.CAN_FRAMEFORMAT_STANDARD):
#     def __repr__(self, long_text=True):
#     def frame_id(self):
#     def frame_id(self, value):
#     def dlc(self):
#     def dlc(self, value):
#     def cycletime(self):
#     def cycletime(self, value):
#     def throttle_time(self):
#     def throttle_time(self, value):
#     def frame_format(self):
#     def frame_format(self, value):
#     def producer_ids(self):
#     def producer_ids(self, value):
#     def get_descriptive_ascii_art(self):
#     def get_signal_mask(self):
#     def is_outbound(self, ego_node_ids):


# Path: tests/test_canframedefinition.py
import sys
import unittest
from can4python import exceptions
from can4python import cansignal
from can4python import canframe_definition


        self.assertRaises(exceptions.CanException, setattr, self.frame_def, 'dlc', -1)
        self.assertRaises(exceptions.CanException, setattr, self.frame_def, 'dlc', 9)
        self.assertRaises(exceptions.CanException, setattr, self.frame_def, 'dlc', "1,0")
        self.assertRaises(exceptions.CanException, setattr, self.frame_def, 'frame_id', None)

        self.assertRaises(exceptions.CanException, setattr, self.frame_def, 'cycletime', -1)
        self.assertRaises(exceptions.CanException, setattr, self.frame_def, 'cycletime', "1,0")
        self.assertRaises(exceptions.CanException, setattr, self.frame_def, 'cycletime', 60001)

        self.assertRaises(exceptions.CanException, setattr, self.frame_def, 'throttle_time', -1)
        self.assertRaises(exceptions.CanException, setattr, self.frame_def, 'throttle_time', "1,0")
        self.assertRaises(exceptions.CanException, setattr, self.frame_def, 'throttle_time', 60001)

        self.assertRaises(exceptions.CanException, setattr, self.frame_def, 'frame_format', 'ABC')
        self.assertRaises(exceptions.CanException, setattr, self.frame_def, 'frame_format', None)
        self.assertRaises(exceptions.CanException, setattr, self.frame_def, 'frame_format', 1)

        self.assertRaises(exceptions.CanException, setattr, self.frame_def, 'producer_ids', 3)
        self.assertRaises(exceptions.CanException, setattr, self.frame_def, 'producer_ids', "3")

    def testIsOutbound(self):
        self.assertTrue(self.frame_def.is_outbound(["9"]))
        self.assertFalse(self.frame_def.is_outbound(["99"]))
        self.assertFalse(self.frame_def.is_outbound([9]))

    def testIsOutboundWrongType(self):
        self.assertRaises(exceptions.CanException, self.frame_def.is_outbound, 9)

    def testGetSignalMask(self):

        testsig2 = cansignal.CanSignalDefinition('testsignal2', 8, 16, endianness='big')  # Two leftmost bytes