# Path: cuburn/profile.py
# BUILTIN={
#     '1080p': dict(width=1920, height=1080),
#     '720p': dict(width=1280, height=720),
#     '540p': dict(width=960, height=540),
#     'preview': dict(width=640, height=360, spp=1200, skip=1)
# }
# def add_args(parser=None):
# def get_from_args(args):
# def wrap(prof, gnm):
# def enumerate_times(gprof):
# def enumerate_jobs(gprof, basename, args, resume=None):


import argparse
import unittest
import numpy as np
from cuburn import profile


class ProfileTest(unittest.TestCase):
    def _get_profile(self, args=None):
        args = args or []
        return profile.get_from_args(profile.add_args().parse_args(args))

    def test_enumerate_times(self):
        name, prof = self._get_profile()
        gprof = profile.wrap(prof, {"type":"edge"})
        frames = list(profile.enumerate_times(gprof))
        frame_times = np.linspace(0, 1 - 1/720., 720) + 0.5/720
        self.assertEquals(frames, list(enumerate(frame_times, 1)))

    def test_nframes_for_sharding_equal(self):
        name, prof = self._get_profile(
                ['-P', '720p', '--fps=1', '--duration=5', '--shard=5'])

# Path: cuburn/profile.py
# BUILTIN={
#     '1080p': dict(width=1920, height=1080),
#     '720p': dict(width=1280, height=720),
#     '540p': dict(width=960, height=540),
#     'preview': dict(width=640, height=360, spp=1200, skip=1)
# }
# def add_args(parser=None):
# def get_from_args(args):
# def wrap(prof, gnm):
# def enumerate_times(gprof):
# def enumerate_jobs(gprof, basename, args, resume=None):


# Path: cuburn/tests/test_profile.py
import argparse
import unittest
import numpy as np
from cuburn import profile



class ProfileTest(unittest.TestCase):
    def _get_profile(self, args=None):
        args = args or []
        return profile.get_from_args(profile.add_args().parse_args(args))

    def test_enumerate_times(self):
        name, prof = self._get_profile()
        gprof = profile.wrap(prof, {"type":"edge"})
        frames = list(profile.enumerate_times(gprof))
        frame_times = np.linspace(0, 1 - 1/720., 720) + 0.5/720
        self.assertEquals(frames, list(enumerate(frame_times, 1)))

    def test_nframes_for_sharding_equal(self):
        name, prof = self._get_profile(
                ['-P', '720p', '--fps=1', '--duration=5', '--shard=5'])

        gprof = profile.wrap(prof, {"type":"edge"})