Skip to content
Snippets Groups Projects
Commit 3f39758a authored by Edward Fauchon-Jones's avatar Edward Fauchon-Jones
Browse files

Update test suite to test format 3 spec

parent 5dcba443
No related branches found
No related tags found
No related merge requests found
......@@ -64,7 +64,25 @@ templateOutput = """# Format 1
- [=] nhatz (1.0)
- [=] Omega (1.0)
- [=] eccentricity (1.0)
- [=] mean_anomaly (1.0)"""
- [=] mean_anomaly (1.0)
# Format 2
- [=] mass1-vs-time (<class 'h5py._hl.dataset.Dataset'>)
- [=] mass2-vs-time (<class 'h5py._hl.dataset.Dataset'>)
- [=] spin1-vs-time (<class 'h5py._hl.dataset.Dataset'>)
- [=] spin2-vs-time (<class 'h5py._hl.dataset.Dataset'>)
- [=] position1-vs-time (<class 'h5py._hl.dataset.Dataset'>)
- [=] position2-vs-time (<class 'h5py._hl.dataset.Dataset'>)
- [=] LNhat-vs-time (<class 'h5py._hl.dataset.Dataset'>)
- [=] Omega-vs-time (<class 'h5py._hl.dataset.Dataset'>)
- [=] nhat-vs-time (<class 'h5py._hl.dataset.Dataset'>)
# Format 3
- [=] remnant-mass-vs-time (<class 'h5py._hl.dataset.Dataset'>)
- [=] remnant-spin-vs-time (<class 'h5py._hl.dataset.Dataset'>)
- [=] remnant-position-vs-time (<class 'h5py._hl.dataset.Dataset'>)"""
class TestValidFile(object):
......@@ -74,7 +92,7 @@ class TestValidFile(object):
self.f = helper.getFormat1HDF5()
def test_valid_file(self):
output = helper.lvcnrcheck([self.f.name])
output = helper.lvcnrcheck(['-f', '3', self.f.name])
assert output.strip() == self.output
......@@ -122,6 +140,17 @@ class TestGroup(TestField):
nr.close()
class TestDataset(TestField):
"""Base for testing individual group fields"""
def convertToGroup(self):
"""Convert the dataset to a group of the represented field"""
nr = h5.File(self.f.name)
del nr[self.name]
nr.create_group(self.name)
nr.close()
class TestInvalidType(TestField):
name = 'type'
......@@ -134,7 +163,7 @@ class TestInvalidType(TestField):
self.setOutput(
'- [WRONG TYPE] type (1.0) (Type must be <type \'basestring\'>)')
output = helper.lvcnrcheck([self.f.name])
output = helper.lvcnrcheck(['-f', '3', self.f.name])
assert output.strip() == self.output
def test_invalid_value(self):
......@@ -146,7 +175,7 @@ class TestInvalidType(TestField):
('- [INVALID VALUE] type (invalid) '
'(Value must be one of NRinjection)'))
output = helper.lvcnrcheck([self.f.name])
output = helper.lvcnrcheck(['-f', '3', self.f.name])
assert output.strip() == self.output
......@@ -159,7 +188,7 @@ class TestInvalidFormat(TestField):
self.setOutput(
'- [WRONG TYPE] Format (1.0) (Type must be <type \'int\'>)')
output = helper.lvcnrcheck([self.f.name])
output = helper.lvcnrcheck(['-f', '3', self.f.name])
assert output.strip() == self.output
def test_invalid_value(self):
......@@ -168,7 +197,7 @@ class TestInvalidFormat(TestField):
('- [INVALID VALUE] Format (0) '
'(Value must be one of 1, 2, 3)'))
output = helper.lvcnrcheck([self.f.name])
output = helper.lvcnrcheck(['-f', '3', self.f.name])
assert output.strip() == self.output
......@@ -182,7 +211,7 @@ class TestInvalidSimulationType(TestField):
('- [WRONG TYPE] simulation-type (1.0) '
'(Type must be <type \'basestring\'>)'))
output = helper.lvcnrcheck([self.f.name])
output = helper.lvcnrcheck(['-f', '3', self.f.name])
assert output.strip() == self.output
def test_invalid_value(self):
......@@ -191,7 +220,7 @@ class TestInvalidSimulationType(TestField):
('- [INVALID VALUE] simulation-type (invalid) '
'(Value must be one of aligned-spins, non-spinning, precessing)'))
output = helper.lvcnrcheck([self.f.name])
output = helper.lvcnrcheck(['-f', '3', self.f.name])
assert output.strip() == self.output
......@@ -205,7 +234,7 @@ class TestInvalidName(TestField):
('- [WRONG TYPE] name (1.0) '
'(Type must be <type \'basestring\'>)'))
output = helper.lvcnrcheck([self.f.name])
output = helper.lvcnrcheck(['-f', '3', self.f.name])
assert output.strip() == self.output
......@@ -219,7 +248,7 @@ class TestInvalidAlternativeNames(TestField):
('- [WRONG TYPE] alternative-names (1.0) '
'(Type must be <type \'basestring\'>)'))
output = helper.lvcnrcheck([self.f.name])
output = helper.lvcnrcheck(['-f', '3', self.f.name])
assert output.strip() == self.output
......@@ -233,7 +262,7 @@ class TestInvalidNRGroup(TestField):
('- [WRONG TYPE] NR-group (1.0) '
'(Type must be <type \'basestring\'>)'))
output = helper.lvcnrcheck([self.f.name])
output = helper.lvcnrcheck(['-f', '3', self.f.name])
assert output.strip() == self.output
......@@ -247,7 +276,7 @@ class TestInvalidNRCode(TestField):
('- [WRONG TYPE] NR-code (1.0) '
'(Type must be <type \'basestring\'>)'))
output = helper.lvcnrcheck([self.f.name])
output = helper.lvcnrcheck(['-f', '3', self.f.name])
assert output.strip() == self.output
......@@ -261,7 +290,7 @@ class TestInvalidRevisionDate(TestField):
('- [WRONG TYPE] revision-date (1.0) '
'(Type must be <type \'basestring\'>)'))
output = helper.lvcnrcheck([self.f.name])
output = helper.lvcnrcheck(['-f', '3', self.f.name])
assert output.strip() == self.output
......@@ -275,7 +304,7 @@ class TestInvalidPointOfContactEmail(TestField):
('- [WRONG TYPE] point-of-contact-email (1.0) '
'(Type must be <type \'basestring\'>)'))
output = helper.lvcnrcheck([self.f.name])
output = helper.lvcnrcheck(['-f', '3', self.f.name])
assert output.strip() == self.output
......@@ -289,7 +318,7 @@ class TestInvalidINSPIREBibtexKeys(TestField):
('- [WRONG TYPE] INSPIRE-bibtex-keys (1.0) '
'(Type must be <type \'basestring\'>)'))
output = helper.lvcnrcheck([self.f.name])
output = helper.lvcnrcheck(['-f', '3', self.f.name])
assert output.strip() == self.output
......@@ -303,7 +332,7 @@ class TestInvalidLicense(TestField):
('- [WRONG TYPE] license (1.0) '
'(Type must be <type \'basestring\'>)'))
output = helper.lvcnrcheck([self.f.name])
output = helper.lvcnrcheck(['-f', '3', self.f.name])
assert output.strip() == self.output
def test_invalid_value(self):
......@@ -312,7 +341,7 @@ class TestInvalidLicense(TestField):
('- [INVALID VALUE] license (invalid) '
'(Value must be one of LSC-internal, public)'))
output = helper.lvcnrcheck([self.f.name])
output = helper.lvcnrcheck(['-f', '3', self.f.name])
assert output.strip() == self.output
......@@ -327,7 +356,7 @@ class TestInvalidAuxiliaryInfo(TestGroup):
'(<class \'h5py._hl.dataset.Dataset\'>) '
'(Type must be <class \'h5py._hl.group.Group\'>)'))
output = helper.lvcnrcheck([self.f.name])
output = helper.lvcnrcheck(['-f', '3', self.f.name])
assert output.strip() == self.output
......@@ -341,7 +370,7 @@ class TestInvalidNRTechniques(TestField):
('- [WRONG TYPE] NR-techniques (1.0) '
'(Type must be <type \'basestring\'>)'))
output = helper.lvcnrcheck([self.f.name])
output = helper.lvcnrcheck(['-f', '3', self.f.name])
assert output.strip() == self.output
......@@ -355,7 +384,7 @@ class TestInvalidFilesInErrorSeries(TestField):
('- [WRONG TYPE] files-in-error-series (1.0) '
'(Type must be <type \'basestring\'>)'))
output = helper.lvcnrcheck([self.f.name])
output = helper.lvcnrcheck(['-f', '3', self.f.name])
assert output.strip() == self.output
......@@ -369,7 +398,7 @@ class TestInvalidComparableSimulation(TestField):
('- [WRONG TYPE] comparable-simulation (1.0) '
'(Type must be <type \'basestring\'>)'))
output = helper.lvcnrcheck([self.f.name])
output = helper.lvcnrcheck(['-f', '3', self.f.name])
assert output.strip() == self.output
......@@ -383,7 +412,7 @@ class TestInvalidProductionRun(TestField):
('- [WRONG TYPE] production-run (1.0) '
'(Type must be <type \'int\'>)'))
output = helper.lvcnrcheck([self.f.name])
output = helper.lvcnrcheck(['-f', '3', self.f.name])
assert output.strip() == self.output
def test_invalid_value(self):
......@@ -392,7 +421,7 @@ class TestInvalidProductionRun(TestField):
('- [INVALID VALUE] production-run (2) '
'(Value must be one of 0, 1)'))
output = helper.lvcnrcheck([self.f.name])
output = helper.lvcnrcheck(['-f', '3', self.f.name])
assert output.strip() == self.output
......@@ -406,7 +435,7 @@ class TestInvalidObject1(TestField):
('- [WRONG TYPE] object1 (1.0) '
'(Type must be <type \'basestring\'>)'))
output = helper.lvcnrcheck([self.f.name])
output = helper.lvcnrcheck(['-f', '3', self.f.name])
assert output.strip() == self.output
def test_invalid_value(self):
......@@ -415,7 +444,7 @@ class TestInvalidObject1(TestField):
('- [INVALID VALUE] object1 (invalid) '
'(Value must be one of BH, NS)'))
output = helper.lvcnrcheck([self.f.name])
output = helper.lvcnrcheck(['-f', '3', self.f.name])
assert output.strip() == self.output
......@@ -429,7 +458,7 @@ class TestInvalidObject2(TestField):
('- [WRONG TYPE] object2 (1.0) '
'(Type must be <type \'basestring\'>)'))
output = helper.lvcnrcheck([self.f.name])
output = helper.lvcnrcheck(['-f', '3', self.f.name])
assert output.strip() == self.output
def test_invalid_value(self):
......@@ -438,7 +467,7 @@ class TestInvalidObject2(TestField):
('- [INVALID VALUE] object2 (invalid) '
'(Value must be one of BH, NS)'))
output = helper.lvcnrcheck([self.f.name])
output = helper.lvcnrcheck(['-f', '3', self.f.name])
assert output.strip() == self.output
......@@ -452,7 +481,7 @@ class TestInvalidMass1(TestField):
('- [WRONG TYPE] mass1 (invalid) '
'(Type must be <type \'float\'>)'))
output = helper.lvcnrcheck([self.f.name])
output = helper.lvcnrcheck(['-f', '3', self.f.name])
assert output.strip() == self.output
......@@ -466,7 +495,7 @@ class TestInvalidMass2(TestField):
('- [WRONG TYPE] mass2 (invalid) '
'(Type must be <type \'float\'>)'))
output = helper.lvcnrcheck([self.f.name])
output = helper.lvcnrcheck(['-f', '3', self.f.name])
assert output.strip() == self.output
......@@ -480,7 +509,7 @@ class TestInvalidEta(TestField):
('- [WRONG TYPE] eta (invalid) '
'(Type must be <type \'float\'>)'))
output = helper.lvcnrcheck([self.f.name])
output = helper.lvcnrcheck(['-f', '3', self.f.name])
assert output.strip() == self.output
......@@ -494,7 +523,7 @@ class TestInvalidFLowerAt1MSUN(TestField):
('- [WRONG TYPE] f_lower_at_1MSUN (invalid) '
'(Type must be <type \'float\'>)'))
output = helper.lvcnrcheck([self.f.name])
output = helper.lvcnrcheck(['-f', '3', self.f.name])
assert output.strip() == self.output
......@@ -508,7 +537,7 @@ class TestInvalidSpin1x(TestField):
('- [WRONG TYPE] spin1x (invalid) '
'(Type must be <type \'float\'>)'))
output = helper.lvcnrcheck([self.f.name])
output = helper.lvcnrcheck(['-f', '3', self.f.name])
assert output.strip() == self.output
......@@ -522,7 +551,7 @@ class TestInvalidSpin1y(TestField):
('- [WRONG TYPE] spin1y (invalid) '
'(Type must be <type \'float\'>)'))
output = helper.lvcnrcheck([self.f.name])
output = helper.lvcnrcheck(['-f', '3', self.f.name])
assert output.strip() == self.output
......@@ -536,7 +565,7 @@ class TestInvalidSpin1z(TestField):
('- [WRONG TYPE] spin1z (invalid) '
'(Type must be <type \'float\'>)'))
output = helper.lvcnrcheck([self.f.name])
output = helper.lvcnrcheck(['-f', '3', self.f.name])
assert output.strip() == self.output
......@@ -550,7 +579,7 @@ class TestInvalidSpin2x(TestField):
('- [WRONG TYPE] spin2x (invalid) '
'(Type must be <type \'float\'>)'))
output = helper.lvcnrcheck([self.f.name])
output = helper.lvcnrcheck(['-f', '3', self.f.name])
assert output.strip() == self.output
......@@ -564,7 +593,7 @@ class TestInvalidSpin2y(TestField):
('- [WRONG TYPE] spin2y (invalid) '
'(Type must be <type \'float\'>)'))
output = helper.lvcnrcheck([self.f.name])
output = helper.lvcnrcheck(['-f', '3', self.f.name])
assert output.strip() == self.output
......@@ -578,7 +607,7 @@ class TestInvalidSpin2z(TestField):
('- [WRONG TYPE] spin2z (invalid) '
'(Type must be <type \'float\'>)'))
output = helper.lvcnrcheck([self.f.name])
output = helper.lvcnrcheck(['-f', '3', self.f.name])
assert output.strip() == self.output
......@@ -592,7 +621,7 @@ class TestInvalidLNhatx(TestField):
('- [WRONG TYPE] LNhatx (invalid) '
'(Type must be <type \'float\'>)'))
output = helper.lvcnrcheck([self.f.name])
output = helper.lvcnrcheck(['-f', '3', self.f.name])
assert output.strip() == self.output
......@@ -606,7 +635,7 @@ class TestInvalidLNhaty(TestField):
('- [WRONG TYPE] LNhaty (invalid) '
'(Type must be <type \'float\'>)'))
output = helper.lvcnrcheck([self.f.name])
output = helper.lvcnrcheck(['-f', '3', self.f.name])
assert output.strip() == self.output
......@@ -620,7 +649,7 @@ class TestInvalidLNhatz(TestField):
('- [WRONG TYPE] LNhatz (invalid) '
'(Type must be <type \'float\'>)'))
output = helper.lvcnrcheck([self.f.name])
output = helper.lvcnrcheck(['-f', '3', self.f.name])
assert output.strip() == self.output
......@@ -634,7 +663,7 @@ class TestInvalidNhatx(TestField):
('- [WRONG TYPE] nhatx (invalid) '
'(Type must be <type \'float\'>)'))
output = helper.lvcnrcheck([self.f.name])
output = helper.lvcnrcheck(['-f', '3', self.f.name])
assert output.strip() == self.output
......@@ -648,7 +677,7 @@ class TestInvalidNhaty(TestField):
('- [WRONG TYPE] nhaty (invalid) '
'(Type must be <type \'float\'>)'))
output = helper.lvcnrcheck([self.f.name])
output = helper.lvcnrcheck(['-f', '3', self.f.name])
assert output.strip() == self.output
......@@ -662,7 +691,7 @@ class TestInvalidNhatz(TestField):
('- [WRONG TYPE] nhatz (invalid) '
'(Type must be <type \'float\'>)'))
output = helper.lvcnrcheck([self.f.name])
output = helper.lvcnrcheck(['-f', '3', self.f.name])
assert output.strip() == self.output
......@@ -676,7 +705,7 @@ class TestInvalidOmega(TestField):
('- [WRONG TYPE] Omega (invalid) '
'(Type must be <type \'float\'>)'))
output = helper.lvcnrcheck([self.f.name])
output = helper.lvcnrcheck(['-f', '3', self.f.name])
assert output.strip() == self.output
......@@ -690,7 +719,7 @@ class TestInvalidEccentricity(TestField):
('- [WRONG TYPE] eccentricity (invalid) '
'(Type must be <type \'float\'>)'))
output = helper.lvcnrcheck([self.f.name])
output = helper.lvcnrcheck(['-f', '3', self.f.name])
assert output.strip() == self.output
......@@ -704,5 +733,5 @@ class TestInvalidMeanAnomaly(TestField):
('- [WRONG TYPE] mean_anomaly (invalid) '
'(Type must be <type \'float\'>)'))
output = helper.lvcnrcheck([self.f.name])
output = helper.lvcnrcheck(['-f', '3', self.f.name])
assert output.strip() == self.output
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment