File tree Expand file tree Collapse file tree 3 files changed +49
-1
lines changed
Expand file tree Collapse file tree 3 files changed +49
-1
lines changed Original file line number Diff line number Diff line change 1+ # Repo guidelines
2+
3+ To run the test suite, first install dependencies:
4+
5+ ```
6+ pip3 install ".[full]"
7+ ```
8+
9+ Then run:
10+
11+ ```
12+ python3 -m unittest
13+ ```
14+
Original file line number Diff line number Diff line change @@ -218,7 +218,7 @@ def eval_monad_list(a):
218218 if isinstance (a , KGChar ):
219219 return str (a )
220220 if isinstance (a , KGSym ):
221- np .asarray ([a ],dtype = object ) # np interpets ':foo" as ':fo"
221+ return np .asarray ([a ],dtype = object ) # np interprets ':foo" as ':fo"
222222 return np .asarray ([a ])
223223
224224
Original file line number Diff line number Diff line change 1+ import unittest
2+ import numpy as np
3+
4+ from klongpy import KlongInterpreter
5+ from klongpy .core import KGSym
6+ from tests .utils import kg_equal
7+
8+
9+ class TestEvalMonadList (unittest .TestCase ):
10+
11+ def setUp (self ):
12+ self .klong = KlongInterpreter ()
13+
14+ def test_int (self ):
15+ r = self .klong (',1' )
16+ self .assertTrue (kg_equal (r , np .asarray ([1 ])))
17+
18+ def test_symbol (self ):
19+ r = self .klong (',:foo' )
20+ self .assertTrue (r .dtype == object )
21+ self .assertEqual (len (r ), 1 )
22+ self .assertEqual (r [0 ], KGSym ('foo' ))
23+
24+ def test_string (self ):
25+ r = self .klong (',"xyz"' )
26+ self .assertTrue (kg_equal (r , np .asarray (['xyz' ], dtype = object )))
27+
28+ def test_list (self ):
29+ r = self .klong (',[1]' )
30+ self .assertTrue (kg_equal (r , np .asarray ([[1 ]], dtype = object )))
31+
32+
33+ if __name__ == '__main__' :
34+ unittest .main ()
You can’t perform that action at this time.
0 commit comments