added tests
parent
9f836cbbb9
commit
081b957b45
|
|
@ -1,4 +1,4 @@
|
||||||
from cyclic_utils import CYCLE_LIMIT,rem_routes
|
from cyclic_utils import rem_routes
|
||||||
|
|
||||||
class Route(object):
|
class Route(object):
|
||||||
"""docstring for Route."""
|
"""docstring for Route."""
|
||||||
|
|
@ -67,7 +67,8 @@ class Transporter(object):
|
||||||
if len(unfulfilled) > 0:
|
if len(unfulfilled) > 0:
|
||||||
print "Contracts from ",repr(unfulfilled)
|
print "Contracts from ",repr(unfulfilled)
|
||||||
|
|
||||||
|
def contract_corridors(self):
|
||||||
|
return rem_routes(self.contract_routes())
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
# Transporter.from_file('./contracts.txt').contracts_required()
|
Transporter.from_file('./contracts.txt').contracts_required()
|
||||||
Transporter.from_file('./contracts.txt').contracts_required()
|
|
||||||
|
|
|
||||||
|
|
@ -1,14 +1,18 @@
|
||||||
import unittest
|
import unittest
|
||||||
import cyclic_contracts
|
from cyclic_contracts import Transporter
|
||||||
|
|
||||||
|
|
||||||
class CyclicTest(unittest.TestCase):
|
class CyclicTest(unittest.TestCase):
|
||||||
"""docstring for CyclicTest."""
|
"""docstring for CyclicTest."""
|
||||||
|
|
||||||
def test_loads():
|
def test_contract(self):
|
||||||
|
cc = Transporter.from_file("./contracts.txt").contract_corridors()
|
||||||
|
self.assertEqual(cc, [('Mumbai', 'Bangalore')])
|
||||||
|
|
||||||
|
def test_partial(self):
|
||||||
|
cc = Transporter.from_file(
|
||||||
|
"./contracts_partial.txt").contract_corridors()
|
||||||
|
self.assertEqual(cc, [('Mumbai', 'Kolkata'), ('Chennai', 'Kolkata')])
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
unittest.main()
|
unittest.main()
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue