Example #1
0
    def test_flatten_sync(self):
        input_sync = {
            'video1': {
                2: {
                    'time': 0,
                },
                1: {
                    'time': 0,
                }
            },
            'video2': {
                0: {
                    'time': 0,
                },
                3: {
                    'time': 0,
                }
            }
        }

        expected_output = {
            0: {
                'url': 'video2',
                'time': 0,
            },
            1: {
                'url': 'video1',
                'time': 0,
            },
            2: {
                'url': 'video1',
                'time': 0,
            },
            3: {
                'url': 'video2',
                'time': 0,
            }
        }

        expected_output = collections.OrderedDict(
            sorted(expected_output.items()))
        effective_output = FileUtils.flatten_sync(input_sync)

        self.assertDictEqual(expected_output, effective_output)
Example #2
0
    def test_flatten_sync(self):
        input_sync = {
            'video1': {
                2: {
                    'time': 0,
                },
                1: {
                    'time': 0,
                }
            },
            'video2': {
                0: {
                    'time': 0,
                },
                3: {
                    'time': 0,
                }
            }
        }

        expected_output = {
            0: {
                'url': 'video2',
                'time': 0,
            },
            1: {
                'url': 'video1',
                'time': 0,
            },
            2: {
                'url': 'video1',
                'time': 0,
            },
            3: {
                'url': 'video2',
                'time': 0,
            }
        }

        expected_output = collections.OrderedDict(sorted(expected_output.items()))
        effective_output = FileUtils.flatten_sync(input_sync)

        self.assertDictEqual(expected_output, effective_output)