Best Python code snippet using grail_python
app_tests.py
Source: app_tests.py
...9 def test_no_output(self):10 """Target should be the same as source."""11 t = make_target_filename(data_dir(), "", "taskpaper")12 self.failUnlessEqual(t, data_dir())13 def test_simple_output(self):14 """Output without os.sep should be considered existing subfolder of source."""15 t = make_target_filename(data_dir(), "results", "taskpaper")16 self.failUnlessEqual(t, os.path.join(data_dir(), "results"))17 def test_simple_output_should_raise_exception(self):18 """Output without os.sep should raise an exception if target does not exist"""19 self.failUnlessRaises(TargetDirectoryDoesNotExistError,20 make_target_filename, data_dir(), "no-result", "taskpaper")21 def test_pathsep(self):22 """Output with a pathsep should be treated as existing folder."""23 output = os.path.abspath(os.path.join(data_dir(), "results"))24 t = make_target_filename(data_dir(), output, "taskpaper")25 self.failUnlessEqual(t, output)26 def test_output_with_full_path_should_raise_exception(self):27 """Function should raise an exception if target does not exist"""28 self.failUnlessRaises(TargetDirectoryDoesNotExistError,29 make_target_filename, data_dir(), "/foo/bar", "taskpaper")30class TargetFilenameForZipTests(unittest.TestCase):31 """Test deriving target filename for a zip file."""32 def test_no_output(self):33 """Target should be the directory the source is located in."""34 t = make_target_filename("/Users/foobar/test/mystuff.ZiP", "", "taskpaper")35 self.failUnlessEqual(t, "/Users/foobar/test")36 def test_simple_output(self):37 """Output without os.sep should be considered existing subfolder of source."""38 t = make_target_filename(os.path.join(data_dir(), "mystuff.ZiP"), "results", "taskpaper")39 self.failUnlessEqual(t, os.path.join(data_dir(), "results"))40 def test_simple_output_should_raise_exception(self):41 """Output without os.sep should raise an exception if target does not exist"""42 self.failUnlessRaises(TargetDirectoryDoesNotExistError,43 make_target_filename, "/Users/foobar/test/mystuff.ZiP", "no-result", "taskpaper")44 def test_output_with_full_path(self):45 """Output that starts with a os.sep is treated as complete path to existing folder."""46 t = make_target_filename("/Users/foobar/test/mystuff.ZiP", os.path.abspath(data_dir()), "taskpaper")47 self.failUnlessEqual(t, os.path.abspath(data_dir()))48 def test_output_with_full_path_should_raise_exception(self):49 """Function should raise an exception if target does not exist"""50 self.failUnlessRaises(TargetDirectoryDoesNotExistError,51 make_target_filename, "/Users/foobar/test/mystuff.ZiP", "/foo/bar", "taskpaper")52class TargetFilenameForFilesTests(unittest.TestCase):53 """Test deriving target filename for a zip file."""54 def test_no_output(self):55 """Target should source file with a new extension."""56 t = make_target_filename("/Users/foobar/test/mystuff.csv", "", "taskpaper")57 self.failUnlessEqual(t, "/Users/foobar/test/mystuff.taskpaper")58 def test_simple_output(self):59 """Output without os.sep in the beginning should be file in same directory than source."""60 t = make_target_filename("/Users/foobar/test/mystuff.csv", "result", "taskpaper")61 self.failUnlessEqual(t, "/Users/foobar/test/result.taskpaper")62 t = make_target_filename("/Users/foobar/test/mystuff.csv", "result/file", "taskpaper")63 self.failUnlessEqual(t, "/Users/foobar/test/result/file.taskpaper")64 def test_output_with_full_path(self):65 """Output that starts with a os.sep is treated as complete path."""66 t = make_target_filename("/Users/foobar/test/mystuff.csv", "/result/file.ext", "taskpaper")...
test_writers.py
Source: test_writers.py
...3import datetime4from mapreduceutils.writers import OutputWriter5import unittest6class TestCSVOutputWriter(unittest.TestCase):7 def test_simple_output(self):8 record = OrderedDict([9 ("sprop_abc", 1),10 ("sprop_bcd", "test message"),11 ("sprop_cde", None)12 ])13 writer = OutputWriter.get_writer('csv')14 out = writer.write(record)15 self.assertEqual("1,test message,\r\n", out)16 def test_escaping(self):17 record = OrderedDict([18 ("sprop_abc", 1),19 ("sprop_bcd", "test,message"),20 ("sprop_cde", None)21 ])22 writer = OutputWriter.get_writer('csv')23 out = writer.write(record)24 self.assertEqual('1,"test,message",\r\n', out)25class TestJSONOutputWriter(unittest.TestCase):26 def test_simple_output(self):27 record = OrderedDict([28 ("sprop_abc", 1),29 ("sprop_bcd", "test message"),30 ("sprop_cde", None)31 ])32 writer = OutputWriter.get_writer('json')33 out = writer.write(record)34 expected = (35 '{'36 '"sprop_abc": 1, '37 '"sprop_bcd": "test message", '38 '"sprop_cde": null'39 '}\r\n'40 )...
test_printout.py
Source: test_printout.py
1from concsp import salt2import pytest3@pytest.mark.skip()4def test_simple_output(state_output):5 for r in state_output:6 salt.print_result(0, r)...
Check out the latest blogs from LambdaTest on this topic:
Automation frameworks enable automation testers by simplifying the test development and execution activities. A typical automation framework provides an environment for executing test plans and generating repeatable output. They are specialized tools that assist you in your everyday test automation tasks. Whether it is a test runner, an action recording tool, or a web testing tool, it is there to remove all the hard work from building test scripts and leave you with more time to do quality checks. Test Automation is a proven, cost-effective approach to improving software development. Therefore, choosing the best test automation framework can prove crucial to your test results and QA timeframes.
QA testers have a unique role and responsibility to serve the customer. Serving the customer in software testing means protecting customers from application defects, failures, and perceived failures from missing or misunderstood requirements. Testing for known requirements based on documentation or discussion is the core of the testing profession. One unique way QA testers can both differentiate themselves and be innovative occurs when senseshaping is used to improve the application user experience.
Many theoretical descriptions explain the role of the Scrum Master as a vital member of the Scrum team. However, these descriptions do not provide an honest answer to the fundamental question: “What are the day-to-day activities of a Scrum Master?”
The web paradigm has changed considerably over the last few years. Web 2.0, a term coined way back in 1999, was one of the pivotal moments in the history of the Internet. UGC (User Generated Content), ease of use, and interoperability for the end-users were the key pillars of Web 2.0. Consumers who were only consuming content up till now started creating different forms of content (e.g., text, audio, video, etc.).
Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!