Closed zhemao closed 12 years ago
If funktown is on pypi, could you add it to the dependencies in setup.py?
Hi @zhemao (CC @bluepeppers)
Thanks very much -- but did you test the patch? After running 'setup.py develop' to pick up funktown, it still fails the unit tests for me:
(django-pydev-venv)mac 05:08:54 (zhemao) > nosetests
Traceback (most recent call last): File "/Users/jacobsen/django-pydev-venv/lib/python2.6/site-packages/nose/case.py", line 197, in runTest self.test(*self.arg) File "/Users/jacobsen/Programming/Lisp/Clojure/pyclojure/pyclojure/test_lisp.py", line 65, in test_core Map()["1"] = 2 File "/Users/jacobsen/Programming/Lisp/Clojure/pyclojure/pyclojure/core.py", line 22, in setitem self.__dict[name] = value TypeError: 'ImmutableDict' object does not support item assignment
Traceback (most recent call last): File "/Users/jacobsen/django-pydev-venv/lib/python2.6/site-packages/nose/case.py", line 197, in runTest self.test(*self.arg) File "/Users/jacobsen/Programming/Lisp/Clojure/pyclojure/pyclojure/test_lisp.py", line 85, in test_eval m[1] = 2 File "/Users/jacobsen/Programming/Lisp/Clojure/pyclojure/pyclojure/core.py", line 22, in setitem self.__dict[name] = value TypeError: 'ImmutableDict' object does not support item assignment
Traceback (most recent call last): File "/Users/jacobsen/django-pydev-venv/lib/python2.6/site-packages/nose/case.py", line 197, in runTest self.test(*self.arg) File "/Users/jacobsen/Programming/Lisp/Clojure/pyclojure/pyclojure/test_lisp.py", line 161, in test_to_string assert tostring(parse("{1 2}")) == "{1 2}" File "/Users/jacobsen/django-pydev-venv/lib/python2.6/site-packages/ply/yacc.py", line 265, in parse return self.parseopt_notrack(input,lexer,debug,tracking,tokenfunc) File "/Users/jacobsen/django-pydev-venv/lib/python2.6/site-packages/ply/yacc.py", line 971, in parseopt_notrack p.callable(pslice) File "/Users/jacobsen/Programming/Lisp/Clojure/pyclojure/pyclojure/parser.py", line 107, in p_map p[0] = make_map(p[2]) File "/Users/jacobsen/Programming/Lisp/Clojure/pyclojure/pyclojure/parser.py", line 31, in make_map m[k] = v File "/Users/jacobsen/Programming/Lisp/Clojure/pyclojure/pyclojure/core.py", line 22, in setitem self.__dict[name] = value TypeError: 'ImmutableDict' object does not support item assignment
Ran 8 tests in 0.183s
FAILED (errors=3) (django-pydev-venv)mac 05:08:56 (zhemao) >
@zhemao (CC @bluepeppers) if you could add a more few unit tests to verify correct behavior (immutability, etc.) to test_lisp.py, that would be even better. Many thanks.
Sorry, I'm not used to using nose. I modified the tests to fit the new, immutable, interface of Map and Vector.
Honestly, I'm right now thinking of moving funktown into pyclojure wholesale. It would be a lot easier to maintain that way, and we wouldn't have to use a bunch of wrapper classes to make the APIs conform. This may take some time though. I'm quite busy with other things (school) at the moment.
Regarding moving funktown into pyclojure, feel free, but it seems like immutable data types might be of general interest. I, for example, might need them for another project I'm working on....
These commits switch to using immutable vectors and maps from the funktown library. Right now, the Vector and Map classes have to wrap ImmutableVector and ImmutableMap from funktown because the interfaces are slightly different. I hope to eventually get it so that PyClojure can use the funktown datastructures directly.