Skip to content

Commit

Permalink
minor cleanups.
Browse files Browse the repository at this point in the history
  • Loading branch information
danthedeckie committed Aug 9, 2018
1 parent 7cd3ea6 commit 1c29dac
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 5 deletions.
11 changes: 11 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,3 +1,14 @@
test:
python test_simpleeval.py
.PHONY: test

dist/:
python setup.py build sdist

pypi: test dist/
twine upload dist/*

clean:
rm -rf build
rm -rf dist
rm file.txt
1 change: 0 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
version=__version__,
description='A simple, safe single expression evaluator library.',
long_description=open('README.rst', 'r').read(),
long_description_content_type="text/markdown",
author='Daniel Fairhead',
author_email='danthedeckie@gmail.com',
url='https://github.com/danthedeckie/simpleeval',
Expand Down
8 changes: 4 additions & 4 deletions simpleeval.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,11 +60,11 @@
if file.txt contents is "11"
>>> def get_file():
with open("file.txt", 'r') as f:
return f.read()
... with open("file.txt", 'r') as f:
... return f.read()
s.functions["get_file"] = get_file
s.eval("int(get_file()) + 31")
>>> s.functions["get_file"] = get_file
>>> s.eval("int(get_file()) + 31")
42
For more information, see the full package documentation on pypi, or the github
Expand Down
3 changes: 3 additions & 0 deletions test_simpleeval.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import operator
import ast
import simpleeval
import os
from simpleeval import (
SimpleEval, EvalWithCompoundTypes, FeatureNotAvailable, FunctionNotDefined, NameNotDefined,
InvalidExpression, AttributeDoesNotExist, simple_eval
Expand Down Expand Up @@ -190,6 +191,8 @@ def load_file(filename):

self.t("int(read('testfile.txt'))", 42)

os.remove('testfile.txt')

def test_randoms(self):
""" test the rand() and randint() functions """

Expand Down

0 comments on commit 1c29dac

Please sign in to comment.