Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F92218486
test_utils_hepdata.py
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Mon, Nov 18, 11:02
Size
22 KB
Mime Type
text/x-python
Expires
Wed, Nov 20, 11:02 (2 d)
Engine
blob
Format
Raw Data
Handle
22396959
Attached To
R3600 invenio-infoscience
test_utils_hepdata.py
View Options
# -*- coding: utf-8 -*-
#
# This file is part of Invenio.
# Copyright (C) 2008, 2009, 2010, 2011, 2015 CERN.
#
# Invenio is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License as
# published by the Free Software Foundation; either version 2 of the
# License, or (at your option) any later version.
#
# Invenio is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with Invenio; if not, write to the Free Software Foundation, Inc.,
# 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
"""Unit tests for the hepdatautils library."""
__revision__
=
"$Id$"
import
os
import
cPickle
from
invenio.base.wrappers
import
lazy_import
from
invenio.testsuite
import
make_test_suite
,
run_test_suite
,
InvenioTestCase
hepdatautils
=
lazy_import
(
'invenio.utils.hepdata.api'
)
Dataset
=
lazy_import
(
'invenio.utils.hepdata.api:Dataset'
)
bibrecord
=
lazy_import
(
'invenio.legacy.bibrecord'
)
class
TestParsingSystematics
(
InvenioTestCase
):
""" Systematics strings to be parsed (we check only that they parse
at all not generating exceptions)
"""
def
test_guess_minimum_encoding
(
self
):
"""textutils - guess_minimum_encoding."""
# self.assertEqual(guess_minimum_encoding('patata'), ('patata', 'ascii'))
# self.assertEqual(False, True, "ble")
# we make sure that this does not cauase any exception !
pass
class
TestDatasetPaperLogic
(
InvenioTestCase
):
""" Testing the business logic classes
"""
def
test_parse_systematics
(
self
):
"""
To be filled when it becomes more clear how to treat systematics
http://hepdata.cedar.ac.uk/view/ins1720
http://hepdata.cedar.ac.uk/view/ins215359
"""
pass
def
test_copy_245_fields_correct_caption
(
self
):
"""Test the case when original record contains already some
instances of 245 field and we want to extend by the HEPDATA
caption """
rec_string
=
"""<record>
<controlfield tag="001">123456</controlfield>
<datafield tag="245" ind1=" " ind2=" ">
<subfield code="a">Some caption</subfield>
</datafield>
<datafield tag="245" ind1=" " ind2=" ">
<subfield code="z">Some ridiculous caption</subfield>
</datafield>
<datafield tag="245" ind1=" " ind2=" ">
<subfield code="a">Hepdata caption</subfield>
<subfield code="9">HEPDATA</subfield>
</datafield>
<!--some other fields-->
<datafield tag="520" ind1="" ind2=" ">
<subfield code="9">HEPDATA</subfield>
</datafield>
<datafield tag="245" ind1="z" ind2=" ">
<subfield code="z">Some ridiculous caption</subfield>
</datafield>
<datafield tag="856" ind1="4" ind2=" ">
<subfield code="z">Some other entry not following even the semantics 2</subfield>
<subfield code="3">ANOTHER</subfield>
</datafield>
</record>"""
rec
=
bibrecord
.
create_record
(
rec_string
)[
0
]
paper
=
hepdatautils
.
Paper
.
create_from_record
(
rec
)
self
.
assertEqual
(
None
,
paper
.
get_diff_marcxml
(
rec
),
\
"There should not be need of a patch on the same record"
)
paper
.
comment
=
"azerty"
diff_xml
=
paper
.
get_diff_marcxml
(
rec
)
self
.
assertTrue
(
diff_xml
.
find
(
">Some caption"
)
==
-
1
,
\
"One of existing captions not found"
)
self
.
assertTrue
(
diff_xml
.
find
(
">Some ridiculous caption"
)
==
-
1
,
\
"One of existing captions not found"
)
self
.
assertTrue
(
diff_xml
.
find
(
">azerty"
)
!=
-
1
,
\
"New caption not found"
)
def
test_copy_245_fields_add_caption
(
self
):
""" Test adding a completely new caption"""
rec_string
=
"""<record>
<controlfield tag="001">123456</controlfield>
<datafield tag="245" ind1=" " ind2=" ">
<subfield code="a">Some caption</subfield>
</datafield>
<datafield tag="245" ind1=" " ind2=" ">
<subfield code="z">Some ridiculous caption</subfield>
</datafield>
<!--some other fields-->
<datafield tag="520" ind1="" ind2=" ">
<subfield code="9">HEPDATA</subfield>
</datafield>
<datafield tag="245" ind1="z" ind2=" ">
<subfield code="z">Some ridiculous caption</subfield>
</datafield>
<datafield tag="856" ind1="4" ind2=" ">
<subfield code="z">Some other entry not following even the semantics 2</subfield>
<subfield code="3">ANOTHER</subfield>
</datafield>
</record>"""
rec
=
bibrecord
.
create_record
(
rec_string
)[
0
]
paper
=
hepdatautils
.
Paper
.
create_from_record
(
rec
)
self
.
assertEqual
(
None
,
paper
.
get_diff_marcxml
(
rec
),
\
"There should not be need of a patch on the same record"
)
paper
.
comment
=
"azerty"
diff_xml
=
paper
.
get_diff_marcxml
(
rec
)
self
.
assertTrue
(
diff_xml
.
find
(
">Some caption"
)
==
-
1
,
\
"One of existing captions not found"
)
self
.
assertTrue
(
diff_xml
.
find
(
">Some ridiculous caption"
)
==
-
1
,
\
"One of existing captions not found"
)
self
.
assertTrue
(
diff_xml
.
find
(
">azerty"
)
!=
-
1
,
\
"New caption not found"
)
def
test_copy_245_fields_remove_caption
(
self
):
""" Test the case when the caption exists but
it should be removed"""
rec_string
=
"""<record>
<controlfield tag="001">123456</controlfield>
<datafield tag="245" ind1=" " ind2=" ">
<subfield code="a">Some caption</subfield>
</datafield>
<datafield tag="245" ind1=" " ind2=" ">
<subfield code="z">Some ridiculous caption</subfield>
</datafield>
<datafield tag="245" ind1=" " ind2=" ">
<subfield code="a">Caption to remove</subfield>
<subfield code="9">HEPDATA</subfield>
</datafield>
<!--some other fields-->
<datafield tag="520" ind1="" ind2=" ">
<subfield code="9">HEPDATA</subfield>
</datafield>
<datafield tag="245" ind1="z" ind2=" ">
<subfield code="z">Some ridiculous caption</subfield>
</datafield>
<datafield tag="856" ind1="4" ind2=" ">
<subfield code="z">Some other entry not following even the semantics 2</subfield>
<subfield code="3">ANOTHER</subfield>
</datafield>
</record>"""
rec
=
bibrecord
.
create_record
(
rec_string
)[
0
]
paper
=
hepdatautils
.
Paper
.
create_from_record
(
rec
)
self
.
assertEqual
(
None
,
paper
.
get_diff_marcxml
(
rec
),
\
"There should not be need of a patch on the same record"
)
paper
.
comment
=
""
# empty caption should not be uploaded
diff_xml
=
paper
.
get_diff_marcxml
(
rec
)
self
.
assertTrue
(
diff_xml
is
None
,
"Expected empty output"
)
def
test_paper_logic
(
self
):
"""Test the case when the main record has to be updated.
Only fields refering to HEPData directly have to be modified,
which means copying all fields not being directly related"""
rec_string
=
"""<record>
<controlfield tag="001">123456</controlfield>
<datafield tag="856" ind1="4" ind2=" ">
<subfield code="z">Some other entry not following even the semantics</subfield>
<subfield code="3">ADDITIONAL HEPDATA</subfield>
</datafield>
<datafield tag="856" ind1="4" ind2=" ">
<subfield code="z">Some other entry not following even the semantics 2</subfield>
<subfield code="3">ANOTHER</subfield>
</datafield>
<datafield tag="856" ind1="4" ind2=" ">
<subfield code="u">http://google.com</subfield>
<subfield code="y">This is the link text</subfield>
<subfield code="3">ADDITIONAL HEPDATA</subfield>
</datafield>
<datafield tag="856" ind1="4" ind2=" ">
<subfield code="u">http://invenio-software.org</subfield>
<subfield code="y">This is some other completely unrelated field</subfield>
<subfield code="3">Different type</subfield>
</datafield>
<datafield tag="856" ind1=" " ind2=" ">
<subfield code="u">http://invenio-software.net</subfield>
<subfield code="y">This should not be copied</subfield>
<subfield code="3">Different type</subfield>
</datafield>
<!-- now fields similar to the one marking existence of HEPDATA -->
<datafield tag="520" ind1=" " ind2=" ">
<subfield code="9">SOMETHING</subfield>
</datafield>
<!-- Now an incorrect caption -->
<datafield tag="245" ind1=" " ind2=" ">
<subfield code="a">Some incorrect caption</subfield>
<subfield code="9">HEPDATA</subfield>
</datafield>
<datafield tag="245" ind1=" " ind2=" ">
<subfield code="a">Some other comment</subfield>
<subfield code="9">SOMETHING ELSE</subfield>
</datafield>
<datafield tag="245" ind1=" " ind2=" ">
<subfield code="u">Something not following the schema</subfield>
</datafield>
<!-- some completely unrelated fields that should not be copied -->
<datafield tag="764" ind1=" " ind2=" ">
<subfield code="u">Something not to repeat</subfield>
</datafield>
<datafield tag="764" ind1=" " ind2=" ">
<subfield code="u">Something not to repeat 2</subfield>
</datafield>
<datafield tag="200" ind1="C" ind2=" ">
<subfield code="a">Something not to repeat 3</subfield>
</datafield>
</record>"""
rec
=
bibrecord
.
create_record
(
rec_string
)[
0
]
# generate entries that differ on title, additional data etc...
paper
=
hepdatautils
.
Paper
()
paper
.
additional_data_links
=
\
[{
"description"
:
"This is the first dataset"
,
\
"href"
:
"http://something.com"
},
\
{
"description"
:
"This is another description"
,
\
"href"
:
"https://invenio-software.org"
},
\
{
"description"
:
"Yet something else"
,
\
"href"
:
"http://and.now.for.something.completely.different"
}]
diff_xml
=
paper
.
get_diff_marcxml
(
rec
)
self
.
assertTrue
(
not
(
diff_xml
is
None
),
"According to the diffing algorithm, records are the same"
)
# print diff_xml
# test the case of uploading an empty set !
def
test_read_empty_dataset
(
self
):
"""Assure that the case of empty dataset does not cause any problems
... this might be the case for example with
http://hepdata.cedar.ac.uk/view/ins215359"""
# Trying to generate columns on an empty dataset
dataset
=
cPickle
.
loads
(
"ccopy_reg
\n
_reconstructor
\n
p1
\n
(cinvenio.utils.hepdata.api
\n
Dataset
\n
p2
\n
c__builtin__
\n
object
\n
p3
\n
NtRp4
\n
(dp5
\n
S'name'
\n
p6
\n
S'Table 7'
\n
p7
\n
sS'column_titles'
\n
p8
\n
(lp9
\n
sS'additional_files'
\n
p10
\n
(lp11
\n
(lp12
\n
S'ins1720/d7/plain.txt'
\n
p13
\n
aS'plain text'
\n
p14
\n
aa(lp15
\n
S'ins1720/d7/aida'
\n
p16
\n
aS'AIDA'
\n
p17
\n
aa(lp18
\n
S'ins1720/d7/pyroot.py'
\n
p19
\n
aS'PYROOT'
\n
p20
\n
aa(lp21
\n
S'ins1720/d7/yoda'
\n
p22
\n
aS'YODA'
\n
p23
\n
aa(lp24
\n
S'ins1720/d7/root'
\n
p25
\n
aS'ROOT'
\n
p26
\n
aa(lp27
\n
S'ins1720/d7/mpl'
\n
p28
\n
aS'mpl'
\n
p29
\n
aa(lp30
\n
S'ins1720/d7/jhepwork.py'
\n
p31
\n
aS'jhepwork'
\n
p32
\n
aasS'comments'
\n
p33
\n
S'<br >Location: F 20<br >Additional systematic error: (RES-DEF(RES=DEL(1232P33)++,BACK=CORRECTED,C=P-WAVE BREIT-WIGNER)//RES-DEF(RES=N(1470P11)+,BACK=CORRECTED,C=P-WAVE BREIT-WIGNER, C=FITTED MASS//RES-DEF(RES=N(1520D13)+,BACK=CORRECTED,C=P-WAVE BREIT-WIGNER, C=FITTED MASS//RES-DEF(RES=N(1688F15)+,BACK=CORRECTED,C=F-WAVE BREIT-WIGNER, C=FITTED MASS)'
\n
p34
\n
sS'data_qualifiers'
\n
p35
\n
(lp36
\n
sS'location'
\n
p37
\n
S''
\n
sS'num_columns'
\n
p38
\n
I2
\n
sS'position'
\n
p39
\n
I0
\n
sS'column_headers'
\n
p40
\n
(lp41
\n
(dp42
\n
S'content'
\n
p43
\n
S''
\n
sS'colspan'
\n
p44
\n
I1
\n
sa(dp45
\n
g43
\n
S'No data is encoded for this table'
\n
p46
\n
sg44
\n
I1
\n
sasS'data'
\n
p47
\n
(lp48
\n
sS'additional_data_links'
\n
p49
\n
(lp50
\n
sb."
)
dataset
.
generate_columns
()
def
test_generate_columns
(
self
):
"""Test the method generating columns of a given dataset"""
def
generate_columns_longer
(
ds
):
""" a much longer implemntation of the column generation"""
from
invenio.legacy.bibrecord
import
record_add_field
rec
=
{}
columns
=
[[
num
,
""
,
""
]
for
num
in
xrange
(
ds
.
num_columns
)]
# (number, header, title)
cur_col
=
0
for
hd
in
ds
.
column_headers
:
for
i
in
xrange
(
hd
[
"colspan"
]):
columns
[
cur_col
][
1
]
=
hd
[
"content"
]
.
strip
()
cur_col
+=
1
cur_col
=
0
for
ct
in
ds
.
column_titles
:
for
i
in
xrange
(
ct
[
"colspan"
]):
columns
[
cur_col
][
2
]
=
ct
[
"content"
]
.
strip
()
cur_col
+=
1
for
col
in
columns
:
subfields
=
[(
"n"
,
str
(
col
[
0
]))]
if
col
[
2
]
!=
""
:
subfields
.
append
((
"t"
,
col
[
2
]))
if
col
[
1
]
!=
""
:
subfields
.
append
((
"d"
,
col
[
1
]))
record_add_field
(
rec
,
"910"
,
subfields
=
subfields
)
return
rec
ds
=
Dataset
()
ds
.
column_headers
=
[{
"content"
:
"header1"
,
"colspan"
:
1
},
{
"content"
:
"header2"
,
"colspan"
:
3
}]
ds
.
column_titles
=
[{
"content"
:
"title1"
,
"colspan"
:
2
},
{
"content"
:
"title2"
,
"colspan"
:
1
}]
ds
.
num_columns
=
6
self
.
assertEqual
(
ds
.
generate_columns
(),
generate_columns_longer
(
ds
),
\
"Incorrectly generated columns"
)
def
test_write_xml
(
self
):
"""Tests the capability of writing xml files"""
fname
=
hepdatautils
.
write_xml_stream_to_tmpfile
(
\
[
"<entry1></entry1>"
,
"<entry2></entry2>"
],
"testing"
)
self
.
assertTrue
(
os
.
path
.
exists
(
fname
),
"results file does not exist"
)
f
=
open
(
fname
,
"r"
)
content
=
f
.
read
()
f
.
close
()
self
.
assertTrue
(
content
.
find
(
"<entry1></entry1>"
)
!=
-
1
,
\
"Can not find required string entry1"
)
self
.
assertTrue
(
content
.
find
(
"<entry2></entry2>"
)
!=
-
1
,
\
"Can not find required string entry2"
)
self
.
assertTrue
(
content
.
find
(
"<?xml"
)
!=
-
1
,
\
"Can not find required XML structure"
)
def
test_update_the_same_record
(
self
):
"""Tests parsing Paper from a record and diffing with the same
hepdata entry.
"""
rec_string
=
"""<record>
<controlfield tag="001">123456</controlfield>
<datafield tag="856" ind1="4" ind2=" ">
<subfield code="z">Some other entry not following even the semantics 2</subfield>
<subfield code="3">ANOTHER</subfield>
</datafield>
<datafield tag="856" ind1="4" ind2=" ">
<subfield code="u">http://google.com</subfield>
<subfield code="y">1 This is the link text</subfield>
<subfield code="3">ADDITIONAL HEPDATA</subfield>
</datafield>
<datafield tag="856" ind1="4" ind2=" ">
<subfield code="u">http://invenio-software.org</subfield>
<subfield code="y">2 This is some other completely unrelated field</subfield>
<subfield code="3">ADDITIONAL HEPDATA</subfield>
</datafield>
<datafield tag="856" ind1=" " ind2=" ">
<subfield code="u">http://invenio-software.net</subfield>
<subfield code="y">This should not be copied</subfield>
<subfield code="3">Different type</subfield>
</datafield>
<datafield tag="520" ind1=" " ind2=" ">
<subfield code="9">HEPDATA</subfield>
</datafield>
</record>
"""
rec
=
bibrecord
.
create_record
(
rec_string
)[
0
]
paper
=
hepdatautils
.
Paper
.
create_from_record
(
rec
)
diff_xml
=
paper
.
get_diff_marcxml
(
rec
)
self
.
assertTrue
(
diff_xml
is
None
,
"Expecting empty XML in the case of the same dataset. Produced XML:
%s
"
%
(
diff_xml
,
))
self
.
assertEqual
(
len
(
paper
.
additional_data_links
),
2
,
"Incorrect number of recognised additional data links"
)
if
paper
.
additional_data_links
[
0
][
"description"
][
0
]
>
\
paper
.
additional_data_links
[
1
][
"description"
][
0
]:
l1
=
paper
.
additional_data_links
[
1
]
l2
=
paper
.
additional_data_links
[
0
]
else
:
l1
=
paper
.
additional_data_links
[
0
]
l2
=
paper
.
additional_data_links
[
1
]
self
.
assertEqual
(
l1
[
"description"
],
"1 This is the link text"
,
"Incorrect first parsed link"
)
self
.
assertEqual
(
l1
[
"href"
],
"http://google.com"
,
"Incorrect first parsed link"
)
self
.
assertEqual
(
l2
[
"description"
],
"2 This is some other completely unrelated field"
,
"Incorrect second parsed link"
)
self
.
assertEqual
(
l2
[
"href"
],
"http://invenio-software.org"
,
"Incorrect second parsed link"
)
def
test_parse_record
(
self
):
"""Tests building record form the MARC XML"""
rec_string
=
"""<record>
<datafield tag="245" ind1=" " ind2=" ">
<subfield code="a">This is the caption</subfield>
<subfield code="9">HEPDATA</subfield>
</datafield>
<datafield tag="520" ind1=" " ind2=" ">
<subfield code="9">HEPDATA</subfield>
</datafield>
<datafield tag="710" ind1=" " ind2=" ">
<subfield code="g">ATLAS</subfield>
</datafield>
<datafield tag="786" ind1=" " ind2=" ">
<subfield code="w">214657</subfield>
<subfield code="r">arXiv:something</subfield>
<subfield code="h">F1</subfield>
</datafield>
<datafield tag="336" ind1=" " ind2=" ">
<subfield code="t">DATASET</subfield>
</datafield>
<datafield tag="980" ind1=" " ind2=" ">
<subfield code="a">DATA</subfield>
</datafield>
<!-- definitions of columns -->
<datafield tag="911" ind1=" " ind2=" ">
<subfield code="x">1</subfield>
<subfield code="y">2</subfield>
</datafield>
<datafield tag="910" ind1=" " ind2=" ">
<subfield code="t">column title</subfield>
<subfield code="d">column description</subfield>
<subfield code="n">0</subfield>
</datafield>
<datafield tag="910" ind1=" " ind2=" ">
<subfield code="t">title2</subfield>
<subfield code="d">column description</subfield>
<subfield code="n">1</subfield>
</datafield>
<datafield tag="910" ind1=" " ind2=" ">
<subfield code="t">title2</subfield>
<subfield code="d">description2</subfield>
<subfield code="n">2</subfield>
</datafield>
<!-- encoding data qualifiers -->
<datafield tag="653" ind1="1" ind2=" ">
<subfield code="r">1</subfield>
<subfield code="c">0</subfield>
<subfield code="c">1</subfield>
</datafield>
<datafield tag="653" ind1="1" ind2=" ">
<subfield code="k">m</subfield>
<subfield code="v">v</subfield>
<subfield code="c">2</subfield>
</datafield>
<datafield tag="653" ind1="1" ind2=" ">
<subfield code="k">p</subfield>
<subfield code="v">q</subfield>
<subfield code="c">0</subfield>
</datafield>
<datafield tag="653" ind1="1" ind2=" ">
<subfield code="k">w</subfield>
<subfield code="v">g</subfield>
<subfield code="c">1</subfield>
<subfield code="c">2</subfield>
</datafield>
<datafield tag="653" ind1="1" ind2=" ">
<subfield code="r">2</subfield>
<subfield code="c">0</subfield>
<subfield code="c">1</subfield>
</datafield>
<datafield tag="653" ind1="1" ind2=" ">
<subfield code="k">z</subfield>
<subfield code="v">v</subfield>
<subfield code="c">2</subfield>
</datafield>
</record>
"""
rec
=
bibrecord
.
create_record
(
rec_string
)
# print "The record string: %s\n" % (str(rec), )
ds
=
Dataset
.
create_from_record
(
rec
[
0
],
'(l.'
,
214657
,
""
)
# print str(ds.data_qualifiers)
self
.
assertEqual
(
3
,
ds
.
num_columns
,
\
"Incorrect number of columns has been read"
)
# asserting column titles:
self
.
assertEqual
(
2
,
len
(
ds
.
column_headers
),
"Incorrect number of headers"
)
self
.
assertEqual
(
"column title"
,
ds
.
column_titles
[
0
][
"content"
],
\
"Incorrect content of the first column"
)
self
.
assertEqual
(
1
,
ds
.
column_titles
[
0
][
"colspan"
],
\
"Incorrect colspan of the title of first column"
)
self
.
assertEqual
(
"title2"
,
ds
.
column_titles
[
1
][
"content"
],
\
"Incorrect content of the second and third column"
)
self
.
assertEqual
(
2
,
ds
.
column_titles
[
1
][
"colspan"
],
\
"Incorrect colspan of the title of second and "
+
\
"third column"
)
# asserting on column descriptions
self
.
assertEqual
(
2
,
len
(
ds
.
column_titles
),
\
"Incorrect number of column titles"
)
self
.
assertEqual
(
"column description"
,
ds
.
column_headers
[
0
][
"content"
],
\
"Incorrect description of the first andsecond"
+
\
" column"
)
self
.
assertEqual
(
2
,
ds
.
column_headers
[
0
][
"colspan"
],
\
"Incorrect colspan of the description first"
+
\
" and second column"
)
self
.
assertEqual
(
"description2"
,
ds
.
column_headers
[
1
][
"content"
],
\
"Incorrect description of the third column"
)
self
.
assertEqual
(
1
,
ds
.
column_headers
[
1
][
"colspan"
],
\
"Incorrect colspan of the description thirdcolumn"
)
self
.
assertEqual
(
3
,
len
(
ds
.
data_qualifiers
),
\
"Incorrect number of detected dscriptor rows"
)
existing_qual
=
[]
for
q_line
in
ds
.
data_qualifiers
:
l_pos
=
0
for
q
in
q_line
:
existing_qual
.
append
((
l_pos
,
q
))
l_pos
+=
1
self
.
assertTrue
((
0
,
{
"content"
:
"RE : 1"
,
"colspan"
:
2
})
in
\
existing_qual
)
self
.
assertTrue
((
1
,
{
"content"
:
"m : v"
,
"colspan"
:
1
})
in
\
existing_qual
)
self
.
assertTrue
((
0
,
{
"content"
:
"p : q"
,
"colspan"
:
1
})
in
\
existing_qual
)
self
.
assertTrue
((
1
,
{
"content"
:
"w : g"
,
"colspan"
:
2
})
in
\
existing_qual
)
self
.
assertTrue
((
0
,
{
"content"
:
"RE : 2"
,
"colspan"
:
2
})
in
\
existing_qual
)
self
.
assertTrue
((
1
,
{
"content"
:
"z : v"
,
"colspan"
:
1
})
in
\
existing_qual
)
# now testing the comparison function ... on the same dataset
ds2
=
Dataset
.
create_from_record
(
rec
[
0
],
'(l.'
,
214657
,
""
)
# print str(ds.get_diff_marcxml(rec[0], None))
# print str(ds.get_diff_marcxml({}, None))
TEST_SUITE
=
make_test_suite
(
TestParsingSystematics
,
TestDatasetPaperLogic
)
if
__name__
==
"__main__"
:
run_test_suite
(
TEST_SUITE
)
Event Timeline
Log In to Comment