Skip to content

Commit

Permalink
Passing tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
mauch committed Feb 6, 2025
1 parent 9deef39 commit 00f6b55
Show file tree
Hide file tree
Showing 7 changed files with 25 additions and 24 deletions.
2 changes: 1 addition & 1 deletion vast_pipeline/pipeline/finalise.py
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ def final_operations(

# upload sources to DB
if add_mode:
# if add mode is being used some sources need to updated where as some
# if add mode is being used some sources need to updated whereas some
# need to be newly uploaded.
# upload new ones first
src_done_mask = srcs_df.index.isin(done_source_ids)
Expand Down
2 changes: 1 addition & 1 deletion vast_pipeline/pipeline/loading.py
Original file line number Diff line number Diff line change
Expand Up @@ -583,7 +583,7 @@ def SQL_update(
SET {set_columns}
FROM (VALUES {values})
AS new_values (index_col, {new_columns})
WHERE {index}=index_col::uuid;
WHERE {index}=index_col::char({model._meta.pk.max_length});
"""

return SQL_comm
6 changes: 3 additions & 3 deletions vast_pipeline/tests/test_pipeline/data/skyc1_srcs_in.csv
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
id,ra,dec,uncertainty_ew,uncertainty_ns,source,d2d,dr,related,epoch
a7dbdab0-2b61-11ec-8d14-4a0009155011,149.983325,-29.977778,0,2,a8dbdab0-2b61-11ec-8d14-4a0009155011,0,0,,1
b9fc9111-1234-1234-1234-123456789012,150.020532,-30.016111,1,3,b0fc9111-1234-1234-1234-123456789012,0,0,,1
id,ra,dec,uncertainty_ew,uncertainty_ns,source,d2d,dr,related,epoch
nfw4NTpiuHyR,149.983325,-29.977778,0,2,qBiUeKm292tM,0,0,,1
o6NPtmgWh5hy,150.020532,-30.016111,1,3,nGsbFDpki3N6,0,0,,1
8 changes: 4 additions & 4 deletions vast_pipeline/tests/test_pipeline/data/skyc2_srcs_in.csv
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
id,ra,dec,uncertainty_ew,uncertainty_ns,source,d2d,dr,related,epoch
a7dbdab0-2b61-11ec-8d14-4a0009155022,149.983324,-29.977779,0.1,1.1,,0,0,,2
b0fc9222-1234-1234-1234-123456789012,149.983318,-30.016111,0.2,1.2,,0,0,,2
b0fc9333-1234-1234-1234-123456789012,150.020523,-30.016108,0.3,1.3,,0,0,,2
id,ra,dec,uncertainty_ew,uncertainty_ns,source,d2d,dr,related,epoch
nfw4NTpiuHyS,149.983324,-29.977779,0.1,1.1,,0,0,,2
AbCd12345AbC,149.983318,-30.016111,0.2,1.2,,0,0,,2
ABCdEFG12345,150.020523,-30.016108,0.3,1.3,,0,0,,2
12 changes: 6 additions & 6 deletions vast_pipeline/tests/test_pipeline/data/sources_df_all.csv
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
id,ra,dec,source,d2d,related,epoch
a7dbdab0-2b61-11ec-8d14-4a0009155011,149.983325,-29.977778,a8dbdab0-2b61-11ec-8d14-4a0009155011,0,,1
b9fc9111-1234-1234-1234-123456789012,150.020532,-30.016111,b0fc9111-1234-1234-1234-123456789012,0,,1
a7dbdab0-2b61-11ec-8d14-4a0009155022,149.983324,-29.977779,3,0,,2
b0fc9222-1234-1234-1234-123456789012,149.983318,-30.016111,4,0,,2
b0fc9333-1234-1234-1234-123456789012,150.020523,-30.016108,5,0,,2
id,ra,dec,source,d2d,related,epoch
nfw4NTpiuHyR,149.983325,-29.977778,qBiUeKm292tM,0,,1
o6NPtmgWh5hy,150.020532,-30.016111,nGsbFDpki3N6,0,,1
nfw4NTpiuHyS,149.983324,-29.977779,3,0,,2
AbCd12345AbC,149.983318,-30.016111,4,0,,2
ABCdEFG12345,150.020523,-30.016108,5,0,,2
6 changes: 3 additions & 3 deletions vast_pipeline/tests/test_pipeline/data/sources_df_ass_in.csv
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
id,ra,dec,source,d2d,related,epoch
a7dbdab0-2b61-11ec-8d14-4a0009155011,149.983325,-29.977778,a8dbdab0-2b61-11ec-8d14-4a0009155011,0,,1
b9fc9111-1234-1234-1234-123456789012,150.020532,-30.016111,b0fc9111-1234-1234-1234-123456789012,0,,1
id,ra,dec,source,d2d,related,epoch
nfw4NTpiuHyR,149.983325,-29.977778,qBiUeKm292tM,0,,1
o6NPtmgWh5hy,150.020532,-30.016111,nGsbFDpki3N6,0,,1
13 changes: 7 additions & 6 deletions vast_pipeline/tests/test_pipeline/test_association.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
advanced_association,
)

from vast_pipeline.utils.utils import UUID_LEN_SOURCE

BASE_PATH = Path(__file__).parent
DATA_PATH = os.path.join(BASE_PATH, 'data')
Expand Down Expand Up @@ -134,7 +135,7 @@ def test_duplicated_skyc2_nonempty(self):
assert skyc2_srcs['source'].loc[[0, 2, 3]].to_list() == [1, 2, 3]
for source_id in skyc2_srcs['source'].loc[[1, 4, 5]]:
assert isinstance(source_id, str)
assert len(source_id) == 36
assert len(source_id) == UUID_LEN_SOURCE
assert skyc2_srcs["related"].fillna(-1).to_list() == [
-1,
[2],
Expand All @@ -147,7 +148,7 @@ def test_duplicated_skyc2_nonempty(self):
assert sources_df['source'].loc[[0, 1, 2, 3, 4]].to_list() == [1, 2, 2, 2, 3]
for source_id in sources_df['source'].loc[[5, 6, 7, 8, 9]]:
assert isinstance(source_id, str)
assert len(source_id) == 36
assert len(source_id) == UUID_LEN_SOURCE


class OneToManyAdvancedTest(SimpleTestCase):
Expand Down Expand Up @@ -250,7 +251,7 @@ def test_method_advanced(self):
]
for source_id in temp_srcs['source_skyc1'].loc[[1, 3, 4]]:
assert isinstance(source_id, str)
assert len(source_id) == 36
assert len(source_id) == UUID_LEN_SOURCE
assert temp_srcs["related_skyc1"].fillna(-1).to_list() == [
-1,
[2],
Expand All @@ -267,7 +268,7 @@ def test_method_advanced(self):
]
for source_id in sources_df['source'].loc[[5, 6, 7, 8, 9]]:
assert isinstance(source_id, str)
assert len(source_id) == 36
assert len(source_id) == UUID_LEN_SOURCE


def test_method_deruiter(self):
Expand Down Expand Up @@ -310,7 +311,7 @@ def test_method_deruiter(self):
]
for source_id in temp_srcs['source_skyc1'].loc[[2, 4, 5]]:
assert isinstance(source_id, str)
assert len(source_id) == 36
assert len(source_id) == UUID_LEN_SOURCE
assert temp_srcs["related_skyc1"].fillna(-1).to_list() == [
-1,
[temp_srcs['source_skyc1'].loc[2]],
Expand All @@ -327,7 +328,7 @@ def test_method_deruiter(self):
]
for source_id in sources_df['source'].loc[[5, 6, 7, 8, 9]]:
assert isinstance(source_id, str)
assert len(source_id) == 36
assert len(source_id) == UUID_LEN_SOURCE


class ManyToManyAdvancedTest(SimpleTestCase):
Expand Down

0 comments on commit 00f6b55

Please sign in to comment.