2, US F\u2020
1, US G, US N, US Y, A, B',
re.DOTALL
) )
# test the multi-applicable notes
btn = find_child( "button.generate[data-id='ob_vehicles_ma_notes_1']" )
btn.click()
wait_for_clipboard( 2, [
( False, "C", "37mm canister has 12" ),
( False, "F", "This AFV may be equi" ),
( False, "G", "May be equipped with" ),
( False, "N", "This vehicle was use" ),
( False, "Y", "If the scenario date" ),
( True, "A", "Use U.S. Vehicle Not" ),
( True, "B", "A vehicle of the sam" ),
( True, "C", "A vehicle of the sam" ),
], transform=_extract_extn_ma_notes )
# ---------------------------------------------------------------------
def _set_test_vasl_extn( webapp, build_info, build_info_fname="buildFile" ):
"""Install a test VASL extension file."""
with TempFile() as temp_file:
with zipfile.ZipFile( temp_file.name, "w" ) as zip_file:
zip_file.writestr( build_info_fname, build_info )
temp_file.close( delete=False )
with open( temp_file.name, "rb" ) as fp:
zip_data = fp.read()
fname = _TEST_VASL_EXTN_FNAME
webapp.control_tests.save_temp_file( fname, zip_data )
return fname
def _check_warning_msgs( webapp, expected ):
"""Check that the startup warning messages are what we expect."""
warnings = webapp.control_tests.get_vasl_mod_warnings()
if expected:
assert len(warnings) == 1
if isinstance( expected, typing.re.Pattern ):
assert expected.search( warnings[0] )
else:
assert warnings[0].startswith( expected )
else:
assert not warnings
def _extract_ma_notes( clipboard ):
"""Extract the multi-applicable notes from a snippet."""
return [
mo.group(1).strip()
for mo in re.finditer( r'
(.*?)
', clipboard, re.DOTALL )
]
def _extract_extn_ma_notes( clipboard ): #pylint: disable=missing-docstring
"""Extract the multi-applicable notes from a snippet, checking for extensions."""
ma_notes = _extract_ma_notes( clipboard )
# NOTE: We return the first few characters of the multi-applicable note content,
# just enough for us to determine whether we're showing the right one or not.
for i,ma_note in enumerate(ma_notes):
is_extn = "❖" in ma_note
mo = re.search( r"
(.+?):(.*)", ma_note, re.DOTALL )
val = mo.group(2).replace( "", "" )
ma_notes[i] = is_extn, mo.group(1).strip(), val.strip()[:20]
return ma_notes