okami.mom/strata
git clone https://git.nkp.pet/okami.mom/strata
e39a52e33
main
1"""The capability table (docs/data/capabilities.json) against the release's packages and the pages that quote it.""" 2import copy 3import os 4import sys 5import unittest 6 7sys .path .insert (0 ,os .path .dirname (os .path .abspath (__file__ ))) 8import capability_table as ct # noqa: E402 9 10 11class CapabilityTable (unittest .TestCase ): 12def setUp (self ): 13self .cap = ct .read_json (ct .DATA ) 14self .release = ct .read_json (ct .RELEASE ) 15 16def test_pages_and_table_are_what_the_generator_writes (self ): 17self .assertEqual (ct .validate (self .cap ,self .release ), []) 18self .assertEqual (ct .read (ct .OUT ).replace ("\r\n" ,"\n" ),ct .page (self .cap ,self .release )) 19for p in ct .PAGES : 20text = ct .read (p ) 21self .assertTrue (ct .MARK_RE .search (text ),p ) 22self .assertEqual (ct .render (self .cap ,self .release ,text ),text ,p ) 23 24def test_a_package_contradicts_a_no (self ): 25cap = copy .deepcopy (self .cap ) 26 {f ["id" ]:f for f in cap ["families" ]}["qwen38" ]["cells" ]["mac" ]["supported" ]= "no" 27problems = ct .validate (cap ,self .release ) 28self .assertTrue (any ("qwen38 on mac is marked 'no'" in p for p in problems ),problems ) 29 30def test_a_yes_without_a_package_is_reported (self ): 31cap = copy .deepcopy (self .cap ) 32 {f ["id" ]:f for f in cap ["families" ]}["qwen36" ]["cells" ]["intel_linux" ]["supported" ]= "yes" 33problems = ct .validate (cap ,self .release ) 34self .assertTrue (any ("no package for it" in p for p in problems ),problems ) 35 36def test_qwen36_packages_are_the_cuda_and_hip_engines_only (self ): 37fam = {f ["id" ]:f for f in self .cap ["families" ]}["qwen36" ] 38pk = ct .packages (self .release ,fam ) 39self .assertNotIn ("mac" ,pk ) 40self .assertNotIn ("intel_linux" ,pk ) 41self .assertIn ("nvidia_win" ,pk ) 42 43def test_the_version_line_names_carried_packages (self ): 44rel = {"product_version" :"0.2.14" ,"control_version" :"0.1.60" ,"engine_version" :"0.1.60" , 45"assets" : ["strata-engine-0.1.60-linux-x86_64-cuda-cuda13.tar.gz" ,"strata-engine-0.1.59-linux-x86_64-sycl.tar.gz" , 46"strata-control-0.1.60-windows-x86_64.zip" ,"strata-control-0.1.59-linux-aarch64.tar.gz" , 47"strata-dsv41-0.1.59-macos-arm64-metal.tar.gz" ,"Strata-0.2.14-macos-arm64.dmg" ]} 48self .assertEqual (ct .versions_line (rel ),"App and Terminal 0.2.14, Control and engines 0.1.60; these packages stay at 0.1.59: " 49"Control linux-aarch64; DeepSeek engines macos-arm64-metal; engines linux-x86_64-sycl. " 50"App, Control and engine versions differ on purpose." ) 51hotfix = {"product_version" :"0.2.13" ,"control_version" :"0.1.59.1" ,"engine_version" :"0.1.59" , 52"assets" : ["strata-control-0.1.59.1-linux-x86_64.tar.gz" ,"strata-engine-0.1.59-linux-x86_64-sycl.tar.gz" ]} 53self .assertEqual (ct .versions_line (hotfix ),"App and Terminal 0.2.13, Control and engines 0.1.59. " 54"App, Control and engine versions differ on purpose." ) 55carried = {"product_version" :"0.2.15" ,"control_version" :"0.1.61" ,"engine_version" :"0.1.60" , 56"assets" : ["strata-control-0.1.61-linux-x86_64.tar.gz" ,"strata-engine-0.1.60-linux-x86_64-cuda-cuda13.tar.gz" ]} 57self .assertEqual (ct .versions_line (carried ),"App and Terminal 0.2.15, Control 0.1.61, engines 0.1.60. " 58"App, Control and engine versions differ on purpose." ) 59 60def test_no_page_keeps_the_old_mac_sentence (self ): 61for p in ct .PAGES : 62self .assertNotIn ("no DeepSeek yet" ,ct .read (p )) 63 64 65if __name__ == "__main__" : 66unittest .main ()