Best Python code snippet using autotest_python
test_core.py
Source: test_core.py
...51 assert_equal(convert_case("from_"), "From")52 assert_equal(convert_case("to"), "To")53 assert_equal(convert_case("friendly_name"), "FriendlyName")54def test_convert_bool():55 assert_equal(convert_boolean(False), "false")56 assert_equal(convert_boolean(True), "true")57 assert_equal(convert_boolean(1), 1)58def test_convert_keys():59 d = {60 "from_": 0,61 "to": 0,62 "friendly_name": 0,63 "ended": 0,64 }65 ed = {66 "From": 0,67 "To": 0,68 "FriendlyName": 0,69 "EndTime": 0,70 }71 assert_equal(ed, convert_keys(d))
test_literaltypes.py
Source: test_literaltypes.py
...26 assert convert_string(1) == '1'27 assert convert_string('a') == 'a'28def test_boolean():29 """Test boolean convertor"""30 assert convert_boolean('1.0')31 assert convert_boolean(1)32 assert convert_boolean('a')33 assert not convert_boolean('f')34 assert not convert_boolean('falSe')35 assert not convert_boolean(False)36 assert not convert_boolean(0)37 assert convert_boolean(-1)38def test_time():39 """Test time convertor"""40 assert convert_time("12:00:00") == datetime.time(12, 0, 0)41 assert isinstance( convert_time(datetime.time(14)), datetime.time)42def test_date():43 """Test date convertor"""44 assert convert_date("2011-07-21") == datetime.date(2011, 7, 21)45 assert isinstance( convert_date(datetime.date(2012, 12, 31)), datetime.date)46def test_datetime():47 """Test datetime convertor"""48 assert convert_datetime("2016-09-22T12:00:00") == datetime.datetime(2016, 9, 22, 12)49 assert isinstance(convert_datetime("2016-09-22T12:00:00Z"), datetime.datetime)50 assert isinstance(convert_datetime("2016-09-22T12:00:00+01:00"), datetime.datetime)51 assert isinstance(convert_datetime(datetime.datetime(2016, 9, 22, 6)), datetime.datetime)
test_get_govt_data.py
Source: test_get_govt_data.py
2from mock import patch3from get_govt_data.get_govt_data import (convert_boolean, cleanup)4class TestGovtData(unittest.TestCase):5 def test_convert_boolean_no(self):6 self.assertEqual(False, convert_boolean('N'))7 self.assertEqual(False, convert_boolean('No'))8 self.assertEqual(False, convert_boolean('n'))9 self.assertEqual(False, convert_boolean('no'))10 self.assertEqual(False, convert_boolean('NO'))11 def test_convert_boolean_yes(self):12 self.assertEqual(True, convert_boolean('Y'))13 self.assertEqual(True, convert_boolean('y'))14 self.assertEqual(True, convert_boolean('Yes'))15 self.assertEqual(True, convert_boolean('YES'))16 self.assertEqual(True, convert_boolean('yes'))17 @patch('get_govt_data.get_govt_data.logging')18 def test_cleanup_successful(self, mock_logging):19 test_dir = 'test'20 cleanup(test_dir)21 mock_logging.info.assert_called_with('Successfully cleaned, {}'.22 format(test_dir))23 @patch('get_govt_data.get_govt_data.logging')24 def test_cleanup_directory_exists(self, mock_logging):25 test_dir = 'test'26 self.assertRaises(FileExistsError, cleanup(test_dir))27 mock_logging.info.assert_called_with('Successfully cleaned, {}'.28 format(test_dir))29 @patch('get_govt_data.get_govt_data.logging')30 def test_cleanup_no_files(self, mock_logging):...
Check out the latest blogs from LambdaTest on this topic:
Before we discuss Scala testing, let us understand the fundamentals of Scala and how this programming language is a preferred choice for your development requirements.The popularity and usage of Scala are rapidly rising, evident by the ever-increasing open positions for Scala developers.
So, now that the first installment of this two fold article has been published (hence you might have an idea of what Agile Testing is not in my opinion), I’ve started feeling the pressure to explain what Agile Testing actually means to me.
Did you know that according to Statista, the number of smartphone users will reach 18.22 billion by 2025? Let’s face it, digital transformation is skyrocketing and will continue to do so. This swamps the mobile app development market with various options and gives rise to the need for the best mobile app testing tools
As a developer, checking the cross browser compatibility of your CSS properties is of utmost importance when building your website. I have often found myself excited to use a CSS feature only to discover that it’s still not supported on all browsers. Even if it is supported, the feature might be experimental and not work consistently across all browsers. Ask any front-end developer about using a CSS feature whose support is still in the experimental phase in most prominent web browsers. ????
The count of mobile users is on a steep rise. According to the research, by 2025, it is expected to reach 7.49 billion users worldwide. 70% of all US digital media time comes from mobile apps, and to your surprise, the average smartphone owner uses ten apps per day and 30 apps each month.
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!!