Fix for #525
This commit is contained in:
@@ -1,4 +1,3 @@
|
|||||||
""" version info """
|
""" version info """
|
||||||
|
|
||||||
__version__ = "0.42.91"
|
__version__ = "0.42.92"
|
||||||
|
|
||||||
|
|||||||
@@ -3296,9 +3296,9 @@ class PhotosDB:
|
|||||||
if options.regex:
|
if options.regex:
|
||||||
flags = re.IGNORECASE if options.ignore_case else 0
|
flags = re.IGNORECASE if options.ignore_case else 0
|
||||||
render_options = RenderOptions(none_str="")
|
render_options = RenderOptions(none_str="")
|
||||||
|
photo_list = []
|
||||||
for regex, template in options.regex:
|
for regex, template in options.regex:
|
||||||
regex = re.compile(regex, flags)
|
regex = re.compile(regex, flags)
|
||||||
photo_list = []
|
|
||||||
for p in photos:
|
for p in photos:
|
||||||
rendered, _ = p.render_template(template, render_options)
|
rendered, _ = p.render_template(template, render_options)
|
||||||
for value in rendered:
|
for value in rendered:
|
||||||
|
|||||||
@@ -6928,6 +6928,36 @@ def test_query_regex_4():
|
|||||||
assert len(json_got) == 2
|
assert len(json_got) == 2
|
||||||
|
|
||||||
|
|
||||||
|
def test_query_regex_multiple():
|
||||||
|
"""test query multiple --regex values (#525)"""
|
||||||
|
import json
|
||||||
|
import os
|
||||||
|
import os.path
|
||||||
|
|
||||||
|
import osxphotos
|
||||||
|
from osxphotos.cli import query
|
||||||
|
|
||||||
|
runner = CliRunner()
|
||||||
|
cwd = os.getcwd()
|
||||||
|
result = runner.invoke(
|
||||||
|
query,
|
||||||
|
[
|
||||||
|
"--json",
|
||||||
|
"--db",
|
||||||
|
os.path.join(cwd, PHOTOS_DB_15_7),
|
||||||
|
"--regex",
|
||||||
|
"I found",
|
||||||
|
"{title}",
|
||||||
|
"--regex",
|
||||||
|
"carry",
|
||||||
|
"{title}",
|
||||||
|
],
|
||||||
|
)
|
||||||
|
assert result.exit_code == 0
|
||||||
|
json_got = json.loads(result.output)
|
||||||
|
|
||||||
|
assert len(json_got) == 2
|
||||||
|
|
||||||
def test_query_function():
|
def test_query_function():
|
||||||
"""test query --query-function"""
|
"""test query --query-function"""
|
||||||
import json
|
import json
|
||||||
|
|||||||
Reference in New Issue
Block a user