Skip to content

Commit

Permalink
removing unused truthyish code
Browse files Browse the repository at this point in the history
  • Loading branch information
dschep committed Feb 6, 2016
1 parent dfb6c4d commit d903b99
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 38 deletions.
11 changes: 0 additions & 11 deletions ntfy/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,6 @@
DEFAULT_CONFIG = '~/.ntfy.yml'


def truthyish(value):
"""
same as standard python truthyness except that strings are different.
True, t, yes, y and 1 (case insensitive) are considered truthy.
"""
if isinstance(value, str):
return value.lower() in ('true', 't', 'yes', 'y', '1')
else:
return bool(value)


def load_config(config_path=DEFAULT_CONFIG):
logger = logging.getLogger(__name__)

Expand Down
28 changes: 1 addition & 27 deletions tests/ntfy_test/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

from mock import patch, mock_open

from ntfy.config import load_config, truthyish
from ntfy.config import load_config

py = version_info.major

Expand All @@ -28,29 +28,3 @@ def test_backwards_compat(self, mock_yamlload):
config = load_config('~/.ntfy.yml')
self.assertIn('backends', config)
self.assertEqual(config['backends'], ['foobar'])

class TestTruthyish(TestCase):
def test_truthyish(self):
self.assertTrue(truthyish('t'))
self.assertTrue(truthyish('T'))
self.assertTrue(truthyish('true'))
self.assertTrue(truthyish('True'))
self.assertTrue(truthyish('TRUE'))
self.assertTrue(truthyish('1'))
self.assertTrue(truthyish('Y'))
self.assertTrue(truthyish('y'))
self.assertTrue(truthyish('yes'))
self.assertTrue(truthyish('YES'))

def test_falseyish(self):
self.assertFalse(truthyish('f'))
self.assertFalse(truthyish('F'))
self.assertFalse(truthyish('false'))
self.assertFalse(truthyish('False'))
self.assertFalse(truthyish('FALSE'))
self.assertFalse(truthyish('0'))
self.assertFalse(truthyish('N'))
self.assertFalse(truthyish('n'))
self.assertFalse(truthyish('no'))
self.assertFalse(truthyish('NO'))

0 comments on commit d903b99

Please sign in to comment.