Adds travis testing skeleton
This commit is contained in:
5
.travis.yml
Normal file
5
.travis.yml
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
language: python
|
||||||
|
python:
|
||||||
|
- "3.6"
|
||||||
|
script:
|
||||||
|
- python3 tests.py
|
||||||
3
tests.py
3
tests.py
@ -1,4 +1,6 @@
|
|||||||
import unittest
|
import unittest
|
||||||
|
from pprint import pprint
|
||||||
|
|
||||||
from copycat import Copycat
|
from copycat import Copycat
|
||||||
|
|
||||||
# TODO: update test cases to use entropy
|
# TODO: update test cases to use entropy
|
||||||
@ -67,6 +69,7 @@ class TestCopycat(unittest.TestCase):
|
|||||||
self.fail('No instances of expected key %s were produced! %r != %r' % (k, actual, expected))
|
self.fail('No instances of expected key %s were produced! %r != %r' % (k, actual, expected))
|
||||||
|
|
||||||
def run_testcase(self, initial, modified, target, iterations, expected):
|
def run_testcase(self, initial, modified, target, iterations, expected):
|
||||||
|
pprint(expected)
|
||||||
actual = Copycat().run(initial, modified, target, iterations)
|
actual = Copycat().run(initial, modified, target, iterations)
|
||||||
self.assertEqual(sum(a['count'] for a in list(actual.values())), iterations)
|
self.assertEqual(sum(a['count'] for a in list(actual.values())), iterations)
|
||||||
self.assertProbabilitiesLookRoughlyLike(actual, expected)
|
self.assertProbabilitiesLookRoughlyLike(actual, expected)
|
||||||
|
|||||||
Reference in New Issue
Block a user