Skip to content

Commit 9c7ad15

Browse files
rtibblesbotclaude
andcommitted
feat: add library enum constants for Kolibri and Community libraries
Adds spec/constants-library.json with KOLIBRI and COMMUNITY enum values. Generated le_utils/constants/library.py and js/Library.js via generate_from_specs.py. test: simplify LIBRARYLIST test assertion Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 311ce52 commit 9c7ad15

4 files changed

Lines changed: 51 additions & 0 deletions

File tree

js/Library.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
// -*- coding: utf-8 -*-
2+
// Generated by scripts/generate_from_specs.py
3+
// Library
4+
5+
export default {
6+
COMMUNITY: "COMMUNITY",
7+
KOLIBRI: "KOLIBRI",
8+
};

le_utils/constants/library.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# -*- coding: utf-8 -*-
2+
# Generated by scripts/generate_from_specs.py
3+
from __future__ import unicode_literals
4+
5+
# Library
6+
7+
COMMUNITY = "COMMUNITY"
8+
KOLIBRI = "KOLIBRI"
9+
10+
choices = (
11+
(COMMUNITY, "Community"),
12+
(KOLIBRI, "Kolibri"),
13+
)
14+
15+
LIBRARYLIST = [
16+
COMMUNITY,
17+
KOLIBRI,
18+
]

spec/constants-library.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
[
2+
"COMMUNITY",
3+
"KOLIBRI"
4+
]

tests/test_library.py

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# -*- coding: utf-8 -*-
2+
from __future__ import unicode_literals
3+
4+
from le_utils.constants import library
5+
6+
7+
def test_library_constants_exist():
8+
assert library.KOLIBRI == "KOLIBRI"
9+
assert library.COMMUNITY == "COMMUNITY"
10+
11+
12+
def test_library_choices():
13+
choices_dict = dict(library.choices)
14+
assert library.KOLIBRI in choices_dict
15+
assert library.COMMUNITY in choices_dict
16+
assert choices_dict[library.KOLIBRI] == "Kolibri"
17+
assert choices_dict[library.COMMUNITY] == "Community"
18+
19+
20+
def test_LIBRARYLIST_exists():
21+
assert library.LIBRARYLIST, "LIBRARYLIST did not generate properly"

0 commit comments

Comments
 (0)