Skip to content
Snippets Groups Projects
Unverified Commit 87512311 authored by Mashiro's avatar Mashiro Committed by GitHub
Browse files

add config test (#10)


* add config test

* Fix typo

Co-authored-by: default avatarZaida Zhou <58739961+zhouzaida@users.noreply.github.com>

* Update tests/config/test_config.py

Co-authored-by: default avatarZaida Zhou <58739961+zhouzaida@users.noreply.github.com>

* Reconstruct config test

* Fix import logic and error test

* Fix path error

* Restructuring Config

* simplify test logic

simplify test logic

* rename test_config file

* add test complex dump and pretty text

* adjust test sequence according to comment

adjust test sequence according to comment

* add comment and test for simple.config.py

* add config test data

* add init

* remove __pycache__

* fix as comment

* add syntax test case

* remove tmp path and modify comment

* add test for setattr

Co-authored-by: default avatarZaida Zhou <58739961+zhouzaida@users.noreply.github.com>
parent 7905f039
No related branches found
No related tags found
No related merge requests found
Showing
with 127 additions and 2 deletions
...@@ -105,8 +105,6 @@ venv.bak/ ...@@ -105,8 +105,6 @@ venv.bak/
# mypy # mypy
.mypy_cache/ .mypy_cache/
data/
data
.vscode .vscode
.idea .idea
.DS_Store .DS_Store
......
exclude: ^tests/data/
repos: repos:
- repo: https://gitlab.com/pycqa/flake8.git - repo: https://gitlab.com/pycqa/flake8.git
rev: 3.8.3 rev: 3.8.3
......
{
"item3": true
}
{
"item1": [1, 2],
"item2": {
"a": 0
},
"item3": true,
"item4": "test"
}
{
"item1": [1, 2],
"item2": {
"a": 0
},
"item3": true,
"item4": "test"
}
{
"_base_": [
"../py_config/base1.py",
"../yaml_config/base2.yaml",
"./base3.json",
"../py_config/base4.py"
],
"item3": false,
"item4": "test",
"item8": "{{fileBasename}}",
"item9": {{ _base_.item2 }},
"item10": {{ _base_.item7.b.c }}
}
{
"_base_": [
"../py_config/test_base_variables.py"
],
"base": "_base_.item8",
"item11": {{ _base_.item8 }},
"item12": {{ _base_.item9 }},
"item13": {{ _base_.item10 }},
"item14": {{ _base_.item1 }},
"item15": {
"a": {
"b": {{ _base_.item2 }}
},
"b": [
{{ _base_.item3 }}
],
"c": [{{ _base_.item4 }}],
"d": [[
{
"e": {{ _base_.item5.a }}
}
],
{{ _base_.item6 }}],
"e": {{ _base_.item1 }}
}
}
{
"item1": "{{ fileDirname }}"
}
{
"filename": "reserved.py"
}
# Copyright (c) OpenMMLab. All rights reserved.
item1 = [1, 2]
item2 = {'a': 0}
item3 = True
item4 = 'test'
# Copyright (c) OpenMMLab. All rights reserved.
item1 = [1, 2]
# Copyright (c) OpenMMLab. All rights reserved.
item5 = dict(a=0, b=1)
item6 = [dict(a=0), dict(b=1)]
item7 = dict(a=[0, 1, 2], b=dict(c=[3.1, 4.2, 5.3]))
# Copyright (c) OpenMMLab. All rights reserved.
test_int = 1
test_list = [1, 2, 3]
# include type, optimizer can be initiated by build_from_cfg
optimizer = dict(type='SGD', lr=0.1, momentum=0.9, weight_decay=0.0001)
# Copyright (c) OpenMMLab. All rights reserved.
item1 = [1, 2]
item2 = {'a': 0}
item3 = True
item4 = 'test'
# Copyright (c) OpenMMLab. All rights reserved.
item1 = [1, 2]
item2 = {'a': 0}
item3 = True
item4 = 'test'
# Copyright (c) OpenMMLab. All rights reserved.
_base_ = [
'./base1.py', '../yaml_config/base2.yaml', '../json_config/base3.json',
'./base4.py'
]
item3 = False
item4 = 'test'
item8 = '{{fileBasename}}'
item9 = {{_base_.item2}}
item10 = {{_base_.item7.b.c}}
# Copyright (c) OpenMMLab. All rights reserved.
_base_ = ['./test_base_variables.py']
base = '_base_.item8'
item11 = {{_base_.item8}}
item12 = {{_base_.item9}}
item13 = {{_base_.item10}}
item14 = {{_base_.item1}}
item15 = dict(
a=dict(b={{_base_.item2}}),
b=[{{_base_.item3}}],
c=[{{_base_.item4}}],
d=[[dict(e={{_base_.item5.a}})], {{_base_.item6}}],
e={{_base_.item1}})
# Copyright (c) OpenMMLab. All rights reserved.
from mmcv import Config # isort:skip
cfg = Config.fromfile('tests/data/config/py_config/simple_config.py')
item5 = cfg.item1[0] + cfg.item2.a
# Copyright (c) OpenMMLab. All rights reserved.
custom_imports = dict(
imports=['test_custom_import_module'], allow_failed_imports=False)
# Copyright (c) OpenMMLab. All rights reserved.
import os
os.environ['TEST_VALUE'] = 'test'
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment