# Path: css2video/constants.py
# class ValueType(object):
#     """Class to define constants for value types"""
# 
#     number = 'number'
#     length = 'length'
#     percentage = 'percentage'
#     time = 'time'
#     color = 'color'
#     text = 'text'
#     url = 'url'
#     function = 'function'
#     array = 'array'
# 
# Path: css2video/parsers/property.py
# class Property(BaseParser):
#     """Parse a CSS property"""
# 
#     ParseException = PropertyParseException
# 
#     @classmethod
#     def grammar(cls):
#         """Grammar to parse a CSS property"""
#         name = pp.Word(pp.alphas + '-')
#         value = Value.parser()
#         return (
#             name +
#             pp.Suppress(pp.Literal(':')) +
#             value +
#             pp.Suppress(pp.Literal(";"))
#         )
# 
#     @classmethod
#     def parse_action(cls, tokens):
#         """Returns a dictionary from the parsed tokens"""
#         return {
#             'property_name': tokens[0].lower(),  # Normalize the name
#             'property_value': tokens[1]
#         }
# 
# class PropertyParseException(Exception):
#     """Raised when there is an exception while parsing a property"""
#     pass


import unittest
from css2video.constants import ValueType
from css2video.parsers.property import Property, PropertyParseException



class TestCase(unittest.TestCase):

    def test_parser(self):
        response = Property.parse('margin: 20px;')
        self.assertEqual(response['property_name'], 'margin')
        self.assertEqual(response['property_value'], dict(
            type=ValueType.length, value=20., unit='px'
        ))


# Path: css2video/constants.py
# class ValueType(object):
#     """Class to define constants for value types"""
# 
#     number = 'number'
#     length = 'length'
#     percentage = 'percentage'
#     time = 'time'
#     color = 'color'
#     text = 'text'
#     url = 'url'
#     function = 'function'
#     array = 'array'
# 
# Path: css2video/parsers/property.py
# class Property(BaseParser):
#     """Parse a CSS property"""
# 
#     ParseException = PropertyParseException
# 
#     @classmethod
#     def grammar(cls):
#         """Grammar to parse a CSS property"""
#         name = pp.Word(pp.alphas + '-')
#         value = Value.parser()
#         return (
#             name +
#             pp.Suppress(pp.Literal(':')) +
#             value +
#             pp.Suppress(pp.Literal(";"))
#         )
# 
#     @classmethod
#     def parse_action(cls, tokens):
#         """Returns a dictionary from the parsed tokens"""
#         return {
#             'property_name': tokens[0].lower(),  # Normalize the name
#             'property_value': tokens[1]
#         }
# 
# class PropertyParseException(Exception):
#     """Raised when there is an exception while parsing a property"""
#     pass


# Path: tests/parsers/test_property.py
import unittest
from css2video.constants import ValueType
from css2video.parsers.property import Property, PropertyParseException




class TestCase(unittest.TestCase):

    def test_parser(self):
        response = Property.parse('margin: 20px;')
        self.assertEqual(response['property_name'], 'margin')
        self.assertEqual(response['property_value'], dict(
            type=ValueType.length, value=20., unit='px'
        ))


        response = Property.parse(' background-color : #FFF ;')