-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
204 additions
and
84 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,42 +1,39 @@ | ||
"""Test for the TNS model.""" | ||
|
||
import pytest | ||
from pydantic import ValidationError | ||
|
||
from frbvoe.models.comet import Comet | ||
|
||
|
||
def test_report(voe): | ||
voe.payload["bandwidth"] | ||
sample_request = { | ||
"kind": "detection", | ||
"date": "2025-01-13 16:55:08.844845", | ||
"email": "john.smith@email.com", | ||
"semi_major": 0.026, | ||
"semi_minor": 0.013, | ||
"sampling_time": 0.001, | ||
"bandwidth": 400, | ||
"central_frequency": 600, | ||
"npol": 2, | ||
"bits_per_sample": 2, | ||
"gain": 1.76, | ||
"tsys": 25.0, | ||
"internal_id": "20210826A", | ||
"dm": 298.53, | ||
"dm_error": 0.01, | ||
"width": 4.8, | ||
"snr": 13.8, | ||
"flux": 4.9, | ||
"right_ascension": 55.2938, | ||
"declination": 14.2049, | ||
"pos_error_deg_95": 0.1, | ||
"importance": 0.9979, | ||
"website": "https://www.example.com", | ||
"tns_name": "FRB20210826A", | ||
"update_message": "", | ||
} | ||
|
||
|
||
def test_bad_voe(): | ||
def test_comet(): | ||
with pytest.raises(ValidationError): | ||
Comet( | ||
kind="detection", | ||
author="John Smith", | ||
email="john.smith@email.com", | ||
coordinate_system="celestial", | ||
right_ascension=55.2938, | ||
declination=14.2049, | ||
localization_error=0.1, | ||
importance=0.9979, | ||
website="https://www.example.com", | ||
backend_url="https://www.example.com/backend", | ||
tns_name="FRB20210826A", | ||
date="2020-01-13 16:55:08.844845", | ||
semi_major=0.026, | ||
semi_minor=0.013, | ||
ellipse_error=0.001, | ||
sampling_time=0.001, | ||
bandwidth=400, | ||
central_frequency=600, | ||
npol=2, | ||
bits_per_sample=2, | ||
gain=1.76, | ||
tsys=25.0, | ||
beam_number=2, | ||
dm=298.53, | ||
dm_error=0.01, | ||
width=4.8, | ||
snr=13.8, | ||
flux=4.9, | ||
) | ||
Comet(**sample_request) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,39 @@ | ||
"""Tests for the Email model.""" | ||
|
||
import pytest | ||
from pydantic import ValidationError | ||
|
||
from frbvoe.models.email import Email | ||
|
||
sample_request = { | ||
"kind": "detection", | ||
"date": "2025-01-13 16:55:08.844845", | ||
"email": "john.smith@email.com", | ||
"semi_major": 0.026, | ||
"semi_minor": 0.013, | ||
"sampling_time": 0.001, | ||
"bandwidth": 400, | ||
"central_frequency": 600, | ||
"npol": 2, | ||
"bits_per_sample": 2, | ||
"gain": 1.76, | ||
"tsys": 25.0, | ||
"internal_id": "20210826A", | ||
"dm": 298.53, | ||
"dm_error": 0.01, | ||
"width": 4.8, | ||
"snr": 13.8, | ||
"flux": 4.9, | ||
"right_ascension": 55.2938, | ||
"declination": 14.2049, | ||
"pos_error_deg_95": 0.1, | ||
"importance": 0.9979, | ||
"website": "https://www.example.com", | ||
"tns_name": "FRB20210826A", | ||
"update_message": "", | ||
} | ||
|
||
|
||
def test_email(): | ||
with pytest.raises(ValidationError): | ||
Email(**sample_request) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,39 @@ | ||
"""Test for the TNS model.""" | ||
|
||
import pytest | ||
from pydantic import ValidationError | ||
|
||
from frbvoe.models.tns import TNS | ||
|
||
sample_request = { | ||
"kind": "detection", | ||
"date": "2025-01-13 16:55:08.844845", | ||
"email": "john.smith@email.com", | ||
"semi_major": 0.026, | ||
"semi_minor": 0.013, | ||
"sampling_time": 0.001, | ||
"bandwidth": 400, | ||
"central_frequency": 600, | ||
"npol": 2, | ||
"bits_per_sample": 2, | ||
"gain": 1.76, | ||
"tsys": 25.0, | ||
"internal_id": "20210826A", | ||
"dm": 298.53, | ||
"dm_error": 0.01, | ||
"width": 4.8, | ||
"snr": 13.8, | ||
"flux": 4.9, | ||
"right_ascension": 55.2938, | ||
"declination": 14.2049, | ||
"pos_error_deg_95": 0.1, | ||
"importance": 0.9979, | ||
"website": "https://www.example.com", | ||
"tns_name": "FRB20210826A", | ||
"update_message": "", | ||
} | ||
|
||
|
||
def test_tns(): | ||
with pytest.raises(ValidationError): | ||
TNS(**sample_request) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,43 @@ | ||
"""Test for VOE model.""" | ||
|
||
# from typing import Dict | ||
|
||
import pytest | ||
from pydantic import ValidationError | ||
|
||
from frbvoe.models.voe import VOEvent | ||
|
||
sample_request = { | ||
"kind": "detection", | ||
"date": "2025-01-13 16:55:08.844845", | ||
"email": "john.smith@email.com", | ||
"semi_major": 0.026, | ||
"semi_minor": 0.013, | ||
"sampling_time": 0.001, | ||
"bandwidth": 400, | ||
"central_frequency": 600, | ||
"npol": 2, | ||
"bits_per_sample": 2, | ||
"gain": 1.76, | ||
"tsys": 25.0, | ||
"internal_id": "20210826A", | ||
"dm": 298.53, | ||
"dm_error": 0.01, | ||
"width": 4.8, | ||
"snr": 13.8, | ||
"flux": 4.9, | ||
"right_ascension": 55.2938, | ||
"declination": 14.2049, | ||
"pos_error_deg_95": 0.1, | ||
"importance": 0.9979, | ||
"website": "https://www.example.com", | ||
"tns_name": "FRB20210826A", | ||
"update_message": "", | ||
} | ||
|
||
|
||
def test_voe(): | ||
with pytest.raises(ValidationError): | ||
VOEvent(**sample_request) | ||
# with pytest.raises(TypeError): | ||
# VOEvent(**sample_request).payload is Dict |