def test_iterate_fields_modif(self): """ Ensure that changing ``values`` inside iteration loop also changes ``OUTPUT`` values. """ for schema, values in iterate_fields(OUTPUT, PROCESS_OUTPUT_SCHEMA): field_name = schema["name"] if field_name == "bases": values[field_name] = str(int(values[field_name]) + 1) self.assertEqual(OUTPUT["bases"], "76") # Fix the OUTPUT to previous state: OUTPUT["bases"] = "75"
def test_iterate_fields_modif(self): """ Ensure that changing of ``values`` inside iteration loop also changes the ``OUTPUT`` values. """ for schema, values in utils.iterate_fields(OUTPUT, PROCESS_OUTPUT_SCHEMA): field_name = schema['name'] if field_name == "bases": values[field_name] = str(int(values[field_name]) + 1) self.assertEqual(OUTPUT['bases'], "76") # Fix the OUTPUT to previous state: OUTPUT['bases'] = "75"
def test_iterate_fields(self): result = list(iterate_fields(OUTPUT, PROCESS_OUTPUT_SCHEMA)) # result object is iterator - we use lists to pull all elements expected = [({ 'type': 'basic:string:', 'name': 'id', 'label': 'ID' }, { 'k': 123, 'id': 'abc' }), ({ 'type': 'basic:string:', 'name': 'bases', 'label': 'Number of bases' }, { 'options': { 'k': 123, 'id': 'abc' }, 'bases': '75', 'fastq': { 'file': 'example.fastq.gz' } }), ({ 'type': 'basic:file:', 'name': 'fastq', 'label': 'Reads file' }, { 'options': { 'k': 123, 'id': 'abc' }, 'bases': '75', 'fastq': { 'file': 'example.fastq.gz' } }), ({ 'type': 'basic:integer:', 'name': 'k', 'label': 'k-mer size' }, { 'k': 123, 'id': 'abc' })] self.assertCountEqual(result, expected)
def test_iterate_fields(self): result = list(iterate_fields(OUTPUT, PROCESS_OUTPUT_SCHEMA)) # result object is iterator - we use lists to pull all elements expected = [ ({ 'type': 'basic:string:', 'name': 'id', 'label': 'ID' }, { 'k': 123, 'id': 'abc' }), ({ 'type': 'basic:string:', 'name': 'bases', 'label': 'Number of bases' }, { 'options': { 'k': 123, 'id': 'abc' }, 'bases': '75', 'fastq': { 'file': 'example.fastq.gz' } }), ({ 'type': 'basic:file:', 'name': 'fastq', 'label': 'Reads file' }, { 'options': { 'k': 123, 'id': 'abc' }, 'bases': '75', 'fastq': { 'file': 'example.fastq.gz' } }), ({ 'type': 'basic:integer:', 'name': 'k', 'label': 'k-mer size' }, { 'k': 123, 'id': 'abc' }) ] self.assertCountEqual(result, expected)
def test_iterate_fields(self): result = list(iterate_fields(OUTPUT, PROCESS_OUTPUT_SCHEMA)) # result object is iterator - we use lists to pull all elements expected = [ ( { "type": "basic:string:", "name": "id", "label": "ID" }, { "k": 123, "id": "abc" }, ), ( { "type": "basic:string:", "name": "bases", "label": "Number of bases" }, { "options": { "k": 123, "id": "abc" }, "bases": "75", "fastq": { "file": "example.fastq.gz" }, }, ), ( { "type": "basic:file:", "name": "fastq", "label": "Reads file" }, { "options": { "k": 123, "id": "abc" }, "bases": "75", "fastq": { "file": "example.fastq.gz" }, }, ), ( { "type": "basic:integer:", "name": "k", "label": "k-mer size" }, { "k": 123, "id": "abc" }, ), ] self.assertCountEqual(result, expected)