# Path: cuburn/genome/convert.py
# class XMLGenomeParser(object):
# class XMLPaletteParser(object):
#     def __init__(self):
#     def start_element(self, name, attrs):
#     def end_element(self, name):
#     def parse(cls, src):
#     def __init__(self, src):
#     def start_element(self, name, attrs):
#     def end_element(self, name):
#     def _load(cls):
#     def lookup(cls, key, isname=False):
# def convert_affine(aff, animate=False):
# def convert_vars(xf):
# def convert_xform(xf):
# def make_symm_xforms(kind, offset):
# def convert_xforms(flame):
# def apply_structure(struct, src):
# def flam3_to_node(flame):
# def nodes_from_xml_path(path):


import unittest
import binascii
import numpy as np
from cuburn.genome import convert
class ConversionTest(unittest.TestCase):
    def test_parse(self):
        parsed = convert.XMLGenomeParser.parse(_make_genome_src())
        converted = convert.flam3_to_node(parsed[0])
        palette = converted.pop('palette')
        self.maxDiff = None
        self.assertEquals(dict(
            type='node',
            author=dict(url='http://test.com', name='strobe'),
            camera=dict(dither_width=1.0, scale=0.03125,
                        center=dict(x=0.01, y=0.02)),
            filters=dict(
                logscale=dict(brightness=4.0),
                colorclip=dict(gamma=4.0)),
            xforms={
                '0': dict(
                    color=0.0,
                    variations=dict(hyperbolic=dict(weight=0.1)),
                    pre_affine=dict(
                        spread=32.220017414088105,
                        angle=[20.91008494006789, -360],
                        magnitude=dict(x=1.019803902718557, y=0.5),
                        offset=dict(x=-0.5, y=-0.6)),
                    weight=0.1)
            }), converted)
        self.assertEquals('rgb8', palette[0])
        self.assertEquals('AQID////', palette[1][:8])

    def test_parse_stock_palette(self):
        try:

# Path: cuburn/genome/convert.py
# class XMLGenomeParser(object):
# class XMLPaletteParser(object):
#     def __init__(self):
#     def start_element(self, name, attrs):
#     def end_element(self, name):
#     def parse(cls, src):
#     def __init__(self, src):
#     def start_element(self, name, attrs):
#     def end_element(self, name):
#     def _load(cls):
#     def lookup(cls, key, isname=False):
# def convert_affine(aff, animate=False):
# def convert_vars(xf):
# def convert_xform(xf):
# def make_symm_xforms(kind, offset):
# def convert_xforms(flame):
# def apply_structure(struct, src):
# def flam3_to_node(flame):
# def nodes_from_xml_path(path):


# Path: cuburn/genome/tests/test_convert.py
import unittest
import binascii
import numpy as np
from cuburn.genome import convert

class ConversionTest(unittest.TestCase):
    def test_parse(self):
        parsed = convert.XMLGenomeParser.parse(_make_genome_src())
        converted = convert.flam3_to_node(parsed[0])
        palette = converted.pop('palette')
        self.maxDiff = None
        self.assertEquals(dict(
            type='node',
            author=dict(url='http://test.com', name='strobe'),
            camera=dict(dither_width=1.0, scale=0.03125,
                        center=dict(x=0.01, y=0.02)),
            filters=dict(
                logscale=dict(brightness=4.0),
                colorclip=dict(gamma=4.0)),
            xforms={
                '0': dict(
                    color=0.0,
                    variations=dict(hyperbolic=dict(weight=0.1)),
                    pre_affine=dict(
                        spread=32.220017414088105,
                        angle=[20.91008494006789, -360],
                        magnitude=dict(x=1.019803902718557, y=0.5),
                        offset=dict(x=-0.5, y=-0.6)),
                    weight=0.1)
            }), converted)
        self.assertEquals('rgb8', palette[0])
        self.assertEquals('AQID////', palette[1][:8])

    def test_parse_stock_palette(self):
        try:

            convert.XMLPaletteParser.lookup(0)