Skip to content

Commit

Permalink
Remove test incompatible with 2.7
Browse files Browse the repository at this point in the history
  • Loading branch information
mwbenowitz committed Apr 30, 2019
1 parent bb72087 commit 81044ad
Showing 1 changed file with 6 additions and 11 deletions.
17 changes: 6 additions & 11 deletions tests/unit/test_readHelper.py
Original file line number Diff line number Diff line change
@@ -1,41 +1,36 @@
import os
import unittest
import yaml
from yaml import YAMLLoadWarning
from aws_lambda.helpers import read


class TestReadHelper(unittest.TestCase):

TEST_FILE = 'readTmp.txt'

def setUp(self):
with open(TestReadHelper.TEST_FILE, 'w') as tmp_file:
tmp_file.write('testYaml: testing')

def tearDown(self):
os.remove(TestReadHelper.TEST_FILE)

def test_read_no_loader_non_binary(self):
fileContents = read(TestReadHelper.TEST_FILE)
self.assertEqual(fileContents, 'testYaml: testing')

def test_read_yaml_loader_non_binary(self):
testYaml = read(TestReadHelper.TEST_FILE, loader=yaml.full_load)
self.assertEqual(testYaml['testYaml'], 'testing')

def test_read_no_loader_binary_mode(self):
fileContents = read(TestReadHelper.TEST_FILE, binary_file=True)
self.assertEqual(fileContents, b'testYaml: testing')

def test_read_yaml_loader_binary_mode(self):
testYaml = read(
TestReadHelper.TEST_FILE,
loader=yaml.full_load,
binary_file=True
)
self.assertEqual(testYaml['testYaml'], 'testing')

def test_read_yaml_old_load_warns(self):
with self.assertWarns(YAMLLoadWarning):
testYaml = read(TestReadHelper.TEST_FILE, loader=yaml.load)
self.assertEqual(testYaml['testYaml'], 'testing')

0 comments on commit 81044ad

Please sign in to comment.