Browse Source

added new test for formatting/searching for time

pull/18/head
theycallmemac 3 years ago
parent
commit
5523496f66
3 changed files with 89 additions and 1 deletions
  1. +1
    -0
      .travis.yml
  2. +1
    -1
      setup.py
  3. +87
    -0
      tests/test_search_dict.py

+ 1
- 0
.travis.yml View File

@@ -11,6 +11,7 @@ script:
- python tests/test_available_now.py
- python tests/test_lookup.py
- python tests/test_builder.py
- python tests/test_search_dict.py

notifications:
email: false

+ 1
- 1
setup.py View File

@@ -15,7 +15,7 @@ setup(name='dcurooms',
classifiers=[
'Environment :: Console',
'Natural Language :: English',
'License :: GPL-3.0 License',
'License :: OSI Approved :: GNU General Public License v3 (GPLv3)',
'Operating System :: OS Independent',
'Programming Language :: Python :: 2.7',
'Programming Language :: Python :: 3.4',


+ 87
- 0
tests/test_search_dict.py View File

@@ -0,0 +1,87 @@
import unittest
import sys
import requests
sys.path.append('.')
from scripts.dcurooms import search_dictionary

class SearchDictTestCase(unittest.TestCase):

def test_not_in_dict_search(self):
test_input_one = '0700'
times = {
'0800': '1',
'0830': '2',
'0900': '3',
'0930': '4',
'1000': '5',
'1030': '6',
'1100': '7',
'1130': '8',
'1200': '9',
'1230': '10',
'1300': '11',
'1330': '12',
'1400': '13',
'1430': '14',
'1500': '15',
'1530': '16',
'1600': '17',
'1630': '18',
'1700': '19',
'1730': '20',
'1800': '21',
'1830': '22',
'1900': '23',
'1930': '24',
'2000': '25',
'2030': '26',
'2100': '27',
'2130': '28',
'2200': '29',
'2230': '30'}
try:
not_in_dict_result = search_dictionary(times, test_input_one)

except SystemExit:
pass

def test_in_dict_search(self):
test_input_two = '1600'
times = {
'0800': '1',
'0830': '2',
'0900': '3',
'0930': '4',
'1000': '5',
'1030': '6',
'1100': '7',
'1130': '8',
'1200': '9',
'1230': '10',
'1300': '11',
'1330': '12',
'1400': '13',
'1430': '14',
'1500': '15',
'1530': '16',
'1600': '17',
'1630': '18',
'1700': '19',
'1730': '20',
'1800': '21',
'1830': '22',
'1900': '23',
'1930': '24',
'2000': '25',
'2030': '26',
'2100': '27',
'2130': '28',
'2200': '29',
'2230': '30'}
in_dict_result = search_dictionary(times, test_input_two)
self.assertTrue(int(in_dict_result) in range(1,31))


if __name__ == '__main__':
unittest.main()

Loading…
Cancel
Save