Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def test_style_multiple():
with fio.open(POLY_FILE) as poly, \
fio.open(LINE_FILE) as lines, \
fio.open(POINT_FILE) as points:
coords = list(poly.bounds) + list(lines.bounds) + list(points.bounds)
bbox = (min(coords[0::4]), min(coords[1::4]), max(coords[2::4]), max(coords[3::4]))
width = 20
# Mix of colors and emoji with a color fill
lyr_color_pairs = [(poly, ':+1:'), (lines, 'blue'), (points, 'red')]
actual = gj2ascii.style_multiple(
lyr_color_pairs, fill='yellow', width=width, bbox=bbox)
assert emoji.unicode_codes.EMOJI_ALIAS_UNICODE[':+1:'] in actual
assert '\x1b[34m\x1b[44m' in actual # blue
assert '\x1b[31m\x1b[41m' in actual # red
assert '\x1b[33m\x1b[43m' in actual # yellow
# Same as above but single character fill
lyr_color_pairs = [(poly, ':+1:'), (lines, 'blue'), (points, 'red')]
actual = gj2ascii.style_multiple(
lyr_color_pairs, fill='.', width=width, bbox=bbox)
assert emoji.unicode_codes.EMOJI_ALIAS_UNICODE[':+1:'] in actual
assert '\x1b[34m\x1b[44m' in actual # blue
assert '\x1b[31m\x1b[41m' in actual # red
assert '.' in actual
# Same as above but emoji fill
lyr_color_pairs = [(poly, ':+1:'), (lines, 'blue'), (points, 'red')]
actual = gj2ascii.style_multiple(