11import os
22import unittest
33import yaml
4- from yaml import YAMLLoadWarning
54from aws_lambda .helpers import read
65
6+
77class TestReadHelper (unittest .TestCase ):
88
99 TEST_FILE = 'readTmp.txt'
1010
1111 def setUp (self ):
1212 with open (TestReadHelper .TEST_FILE , 'w' ) as tmp_file :
1313 tmp_file .write ('testYaml: testing' )
14-
14+
1515 def tearDown (self ):
1616 os .remove (TestReadHelper .TEST_FILE )
17-
17+
1818 def test_read_no_loader_non_binary (self ):
1919 fileContents = read (TestReadHelper .TEST_FILE )
2020 self .assertEqual (fileContents , 'testYaml: testing' )
21-
21+
2222 def test_read_yaml_loader_non_binary (self ):
2323 testYaml = read (TestReadHelper .TEST_FILE , loader = yaml .full_load )
2424 self .assertEqual (testYaml ['testYaml' ], 'testing' )
25-
25+
2626 def test_read_no_loader_binary_mode (self ):
2727 fileContents = read (TestReadHelper .TEST_FILE , binary_file = True )
2828 self .assertEqual (fileContents , b'testYaml: testing' )
29-
29+
3030 def test_read_yaml_loader_binary_mode (self ):
3131 testYaml = read (
3232 TestReadHelper .TEST_FILE ,
3333 loader = yaml .full_load ,
3434 binary_file = True
3535 )
3636 self .assertEqual (testYaml ['testYaml' ], 'testing' )
37-
38- def test_read_yaml_old_load_warns (self ):
39- with self .assertWarns (YAMLLoadWarning ):
40- testYaml = read (TestReadHelper .TEST_FILE , loader = yaml .load )
41- self .assertEqual (testYaml ['testYaml' ], 'testing' )
0 commit comments