Repository: feder-observatory/stellarphot

Issue:
The filter name in a PassbandMapEntry should be non-empty
Right now you can enter no name at all or an empty name in a PassbandMapEntry. That should be impossible. The fix is straightforward -- the type for that field should change from `str` to `NonEmptyStr`.



Discussion:
codecov-commenter: ## [Codecov](https://app.codecov.io/gh/feder-observatory/stellarphot/pull/297?dropdown=coverage&src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=feder-observatory) Report
All modified and coverable lines are covered by tests :white_check_mark:
> Project coverage is 72.32%. Comparing base [(`f927559`)](https://app.codecov.io/gh/feder-observatory/stellarphot/commit/f92755953473cdf2c2a1d1f99040fb4536d5ab84?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=feder-observatory) to head [(`308f23b`)](https://app.codecov.io/gh/feder-observatory/stellarphot/pull/297?dropdown=coverage&src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=feder-observatory).
> Report is 1 commits behind head on main.


<details><summary>Additional details and impacted files</summary>


```diff
@@            Coverage Diff             @@
##             main     #297      +/-   ##
==========================================
+ Coverage   71.86%   72.32%   +0.46%     
==========================================
  Files          26       26              
  Lines        3220     3220              
==========================================
+ Hits         2314     2329      +15     
+ Misses        906      891      -15     
```



</details>

[:umbrella: View full report in Codecov by Sentry](https://app.codecov.io/gh/feder-observatory/stellarphot/pull/297?dropdown=coverage&src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=feder-observatory).   
:loudspeaker: Have feedback on the report? [Share it here](https://about.codecov.io/codecov-pr-comment-feedback/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=feder-observatory).

mwcraig: Yes, but you will want the last part of the `pip install` to use the branch name for this PR, which is up at the top of the PR:

<img width="1047" alt="Cursor_and_Require_filter_name_in_PassbandMapEntry_to_not_have_weird_whitespace_by_mwcraig_·_Pull_Request__297_·_feder-observatory_stellarphot" src="https://github.com/feder-observatory/stellarphot/assets/1147167/e07dd270-44ee-41e8-b9f0-8808eb484842">

mwcraig: @Tanner728 can you please mark this as approved? Go to the "Files changed" tab the click the "Review changes" green button

Patch:
diff --git a/stellarphot/settings/models.py b/stellarphot/settings/models.py
index 5a68464..fb38187 100644
--- a/stellarphot/settings/models.py
+++ b/stellarphot/settings/models.py
@@ -758,11 +758,9 @@ class PassbandMapEntry(BaseModel):
     """
 
     your_filter_name: Annotated[
-        str, Field(description="Instrumental Filter Name", examples=["Sloan r"])
-    ]
-    aavso_filter_name: Annotated[
-        AAVSOFilters, Field(title="AAVSO Filter Name", default="SR")
+        NonEmptyStr, Field(description="Instrumental Filter Name")
     ]
+    aavso_filter_name: Annotated[AAVSOFilters, Field(title="AAVSO Filter Name")]
 
 
 class PassbandMap(BaseModelWithTableRep):


Test patch:
diff --git a/stellarphot/settings/tests/test_models.py b/stellarphot/settings/tests/test_models.py
index 1f1be90..5513709 100644
--- a/stellarphot/settings/tests/test_models.py
+++ b/stellarphot/settings/tests/test_models.py
@@ -563,6 +563,12 @@ def test_passband_map_init_with_passband_map():
     assert pb_map == pb_map2
 
 
+def test_passband_map_entry_empty_name_raises_error():
+    # Name of your filter cannot be empty
+    with pytest.raises(ValidationError, match="name must not be empty"):
+        PassbandMapEntry(your_filter_name="", aavso_filter_name="V")
+
+
 def test_create_invalid_exoplanet():
     # Set some bad values and make sure they raise validation errors
     values = DEFAULT_EXOPLANET_SETTINGS.copy()