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_vol_year_page():
", () "
ref_line = u"""24, (1930) 418"""
r = find_numeration(ref_line)
assert r['volume'] == u"24"
assert r['year'] == u"1930"
assert r['page'] == u"418"
def test_vol_page_year():
", ()"
ref_line = u"""24, 418 (1930)"""
r = find_numeration(ref_line)
assert r['volume'] == u"24"
assert r['year'] == u"1930"
assert r['page'] == u"418"
def look_for_implied_ibids(splitted_citations):
def look_for_journal(els):
for el in els:
if el['type'] == 'JOURNAL':
return True
return False
current_journal = None
for citation in splitted_citations:
if current_journal and not look_for_journal(citation):
for el in citation:
if el['type'] == 'MISC':
numeration = find_numeration(el['misc_txt'])
if numeration:
if not numeration['series']:
numeration['series'] = extract_series_from_volume(
current_journal['volume'])
if numeration['series']:
volume = numeration[
'series'] + numeration['volume']
else:
volume = numeration['volume']
ibid_el = {'type': 'JOURNAL',
'misc_txt': '',
'title': current_journal['title'],
'volume': volume,
'year': numeration['year'],
'page': numeration['page'] or numeration['jinst_page'],
'page_end': numeration['page_end'],