293droid commited on
Commit
0937f0d
·
1 Parent(s): 8d19a5b

feat: water hardness mode with sodium citrate recommendation via Codex

Browse files
Files changed (1) hide show
  1. test_setup.py +28 -20
test_setup.py CHANGED
@@ -1,23 +1,31 @@
1
- # Test 1: chemistry engine
2
- from chemistry import calculate_lye, score_recipe, find_substitutes
3
-
4
- recipe = {"coconut oil": 150, "olive oil": 350}
5
- result = calculate_lye(recipe, superfat=5)
6
- print(f"✅ Chemistry engine: NaOH = {result['naoh_g']}g")
7
-
8
- # Test 2: Ollama
9
- import ollama
10
- response = ollama.chat(
11
- model="llama3.2:latest",
12
- messages=[{"role": "user", "content": "Say hello in one sentence."}]
13
- )
14
- print(f"✅ Ollama: {response['message']['content']}")
15
-
16
- # Test 3: HF login
17
- from huggingface_hub import whoami
18
- user = whoami()
19
- print(f"✅ HF logged in as: {user['name']}")
20
-
 
 
 
 
 
 
 
 
21
 
22
 
23
 
 
1
+
2
+ import pytest
3
+ from chemistry import calculate_lye
4
+
5
+
6
+ def test_chemistry_engine():
7
+ recipe = {"coconut oil": 150, "olive oil": 350}
8
+ result = calculate_lye(recipe, superfat=5)
9
+ assert isinstance(result, dict)
10
+ assert 'naoh_g' in result
11
+
12
+
13
+ def test_ollama_optional():
14
+ pytest.importorskip("ollama")
15
+ import ollama
16
+ response = ollama.chat(
17
+ model="llama3.2:latest",
18
+ messages=[{"role": "user", "content": "Say hello in one sentence."}]
19
+ )
20
+ assert 'message' in response
21
+
22
+
23
+ def test_hf_login_optional():
24
+ pytest.importorskip("huggingface_hub")
25
+ from huggingface_hub import whoami
26
+ user = whoami()
27
+ assert 'name' in user
28
+
29
 
30
 
31