mirror of
https://github.com/invoke-ai/InvokeAI
synced 2024-08-30 20:32:17 +00:00
adjust unit test to account for nsfw always being true now
This commit is contained in:
parent
3e206d4d6a
commit
0ce8472562
@ -13,9 +13,10 @@ init1 = OmegaConf.create(
|
|||||||
'''
|
'''
|
||||||
InvokeAI:
|
InvokeAI:
|
||||||
Features:
|
Features:
|
||||||
nsfw_checker: False
|
always_use_cpu: false
|
||||||
Memory/Performance:
|
Memory/Performance:
|
||||||
max_cache_size: 5
|
max_cache_size: 5
|
||||||
|
tiled_decode: false
|
||||||
'''
|
'''
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -23,9 +24,10 @@ init2 = OmegaConf.create(
|
|||||||
'''
|
'''
|
||||||
InvokeAI:
|
InvokeAI:
|
||||||
Features:
|
Features:
|
||||||
nsfw_checker: true
|
always_use_cpu: true
|
||||||
Memory/Performance:
|
Memory/Performance:
|
||||||
max_cache_size: 2
|
max_cache_size: 2
|
||||||
|
tiled_decode: true
|
||||||
'''
|
'''
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -36,20 +38,21 @@ def test_use_init():
|
|||||||
conf1 = InvokeAIAppConfig.get_config()
|
conf1 = InvokeAIAppConfig.get_config()
|
||||||
assert conf1
|
assert conf1
|
||||||
conf1.parse_args(conf=init1,argv=[])
|
conf1.parse_args(conf=init1,argv=[])
|
||||||
|
assert not conf1.tiled_decode
|
||||||
assert conf1.max_cache_size==5
|
assert conf1.max_cache_size==5
|
||||||
assert not conf1.nsfw_checker
|
assert not conf1.always_use_cpu
|
||||||
|
|
||||||
conf2 = InvokeAIAppConfig.get_config()
|
conf2 = InvokeAIAppConfig.get_config()
|
||||||
assert conf2
|
assert conf2
|
||||||
conf2.parse_args(conf=init2,argv=[])
|
conf2.parse_args(conf=init2,argv=[])
|
||||||
assert conf2.nsfw_checker
|
assert conf2.tiled_decode
|
||||||
assert conf2.max_cache_size==2
|
assert conf2.max_cache_size==2
|
||||||
assert not hasattr(conf2,'invalid_attribute')
|
assert not hasattr(conf2,'invalid_attribute')
|
||||||
|
|
||||||
def test_argv_override():
|
def test_argv_override():
|
||||||
conf = InvokeAIAppConfig.get_config()
|
conf = InvokeAIAppConfig.get_config()
|
||||||
conf.parse_args(conf=init1,argv=['--nsfw_checker','--max_cache=10'])
|
conf.parse_args(conf=init1,argv=['--always_use_cpu','--max_cache=10'])
|
||||||
assert conf.nsfw_checker
|
assert conf.always_use_cpu
|
||||||
assert conf.max_cache_size==10
|
assert conf.max_cache_size==10
|
||||||
assert conf.outdir==Path('outputs') # this is the default
|
assert conf.outdir==Path('outputs') # this is the default
|
||||||
|
|
||||||
@ -57,10 +60,10 @@ def test_env_override():
|
|||||||
# argv overrides
|
# argv overrides
|
||||||
conf = InvokeAIAppConfig()
|
conf = InvokeAIAppConfig()
|
||||||
conf.parse_args(conf=init1,argv=['--max_cache=10'])
|
conf.parse_args(conf=init1,argv=['--max_cache=10'])
|
||||||
assert conf.nsfw_checker==False
|
assert conf.always_use_cpu==False
|
||||||
os.environ['INVOKEAI_nsfw_checker'] = 'True'
|
os.environ['INVOKEAI_always_use_cpu'] = 'True'
|
||||||
conf.parse_args(conf=init1,argv=['--max_cache=10'])
|
conf.parse_args(conf=init1,argv=['--max_cache=10'])
|
||||||
assert conf.nsfw_checker==True
|
assert conf.always_use_cpu==True
|
||||||
|
|
||||||
# environment variables should be case insensitive
|
# environment variables should be case insensitive
|
||||||
os.environ['InvokeAI_Max_Cache_Size'] = '15'
|
os.environ['InvokeAI_Max_Cache_Size'] = '15'
|
||||||
@ -69,8 +72,8 @@ def test_env_override():
|
|||||||
assert conf.max_cache_size == 15
|
assert conf.max_cache_size == 15
|
||||||
|
|
||||||
conf = InvokeAIAppConfig()
|
conf = InvokeAIAppConfig()
|
||||||
conf.parse_args(conf=init1,argv=['--no-nsfw_checker','--max_cache=10'])
|
conf.parse_args(conf=init1,argv=['--no-always_use_cpu','--max_cache=10'])
|
||||||
assert conf.nsfw_checker==False
|
assert conf.always_use_cpu==False
|
||||||
assert conf.max_cache_size==10
|
assert conf.max_cache_size==10
|
||||||
|
|
||||||
conf = InvokeAIAppConfig.get_config(max_cache_size=20)
|
conf = InvokeAIAppConfig.get_config(max_cache_size=20)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user