-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #37 from neutrons/keep-user
Keep user data
- Loading branch information
Showing
6 changed files
with
88 additions
and
11 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 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 |
---|---|---|
@@ -0,0 +1,43 @@ | ||
from enum import StrEnum | ||
|
||
|
||
class Instruments(StrEnum): | ||
ARCS = "arcs" | ||
CG2 = "cg2" | ||
CNCs = "cncs" | ||
CORELLI = "corelli" | ||
EQSANS = "eqsans" | ||
HB2A = "hb2a" | ||
HB2B = "hb2b" | ||
HB2C = "hb2c" | ||
HB3A = "hb3a" | ||
HYS = "hys" | ||
MANDI = "mandi" | ||
NOM = "nom" | ||
PG3 = "pg3" | ||
REF_L = "ref_l" | ||
REF_M = "ref_m" | ||
SEQ = "seq" | ||
SNAP = "snap" | ||
TOPAZ = "topaz" | ||
USANS = "usans" | ||
VULCAN = "vulcan" | ||
# instruments that haven't published to livedata yet | ||
BL0 = "bl0" | ||
BSS = "bss" | ||
CG1D = "cg1d" | ||
CG3 = "cg3" | ||
FNPB = "fnpb" | ||
HB3 = "hb3" | ||
NOWB = "nowb" | ||
NOWD = "nowd" | ||
NOWG = "nowg" | ||
NOWV = "nowv" | ||
NOWX = "nowx" | ||
NSE = "nse" | ||
VENUS = "venus" | ||
VIS = "vis" | ||
|
||
@classmethod | ||
def has_value(cls, value): | ||
return any(value == item.value for item in cls) |
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 |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import sys | ||
from pathlib import Path | ||
|
||
import pytest | ||
|
||
sys.path.append(str(Path(__file__).parents[1])) | ||
from src.config.instruments import Instruments | ||
|
||
|
||
@pytest.mark.parametrize("instrument", ["fake_instrument", "ref_m"]) | ||
def test_enum(instrument): | ||
assert Instruments.has_value(instrument) == (instrument == "ref_m") |