How to use __dir__ method in autotest

Best Python code snippet using autotest_python

dir_for_dir.py

Source:dir_for_dir.py Github

copy

Full Screen

1# apply dir() function to list returned by dir function2def f():3 x = 104 def inner(a):5 y = x + a6 print(y)7 return inner8c = f()9L = dir(c.__closure__)10for item in L:11 print(f"for '{item}': \n", eval(f"dir(c.__closure__.{item})"), end='\n\n')12# output: 13# for '__add__': 14# ['__call__', '__class__', '__delattr__', '__dir__', '__doc__', '__eq__', '__format__', '__ge__', '__getattribute__', '__gt__', '__hash__', '__init__', '__init_subclass__', '__le__', '__lt__', '__name__', '__ne__', '__new__', '__objclass__', '__qualname__', '__reduce__', '__reduce_ex__', '__repr__', '__self__', '__setattr__', '__sizeof__', '__str__', '__subclasshook__', '__text_signature__']15# for '__class__': 16# ['__add__', '__class__', '__class_getitem__', '__contains__', '__delattr__', '__dir__', '__doc__', '__eq__', '__format__', '__ge__', '__getattribute__', '__getitem__', '__getnewargs__', '__gt__', '__hash__', '__init__', '__init_subclass__', '__iter__', '__le__', '__len__', '__lt__', '__mul__', '__ne__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__rmul__', '__setattr__', '__sizeof__', '__str__', '__subclasshook__', 'count', 'index']17# for '__class_getitem__': 18# ['__call__', '__class__', '__delattr__', '__dir__', '__doc__', '__eq__', '__format__', '__ge__', '__getattribute__', '__gt__', '__hash__', '__init__', '__init_subclass__', '__le__', '__lt__', '__module__', '__name__', '__ne__', '__new__', '__qualname__', '__reduce__', '__reduce_ex__', '__repr__', '__self__', '__setattr__', '__sizeof__', '__str__', '__subclasshook__', '__text_signature__']19# for '__contains__': 20# ['__call__', '__class__', '__delattr__', '__dir__', '__doc__', '__eq__', '__format__', '__ge__', '__getattribute__', '__gt__', '__hash__', '__init__', '__init_subclass__', '__le__', '__lt__', '__name__', '__ne__', '__new__', '__objclass__', '__qualname__', '__reduce__', '__reduce_ex__', '__repr__', '__self__', '__setattr__', '__sizeof__', '__str__', '__subclasshook__', '__text_signature__']21# for '__delattr__': 22# ['__call__', '__class__', '__delattr__', '__dir__', '__doc__', '__eq__', '__format__', '__ge__', '__getattribute__', '__gt__', '__hash__', '__init__', '__init_subclass__', '__le__', '__lt__', '__name__', '__ne__', '__new__', '__objclass__', '__qualname__', '__reduce__', '__reduce_ex__', '__repr__', '__self__', '__setattr__', '__sizeof__', '__str__', '__subclasshook__', '__text_signature__']23# for '__dir__': 24# ['__call__', '__class__', '__delattr__', '__dir__', '__doc__', '__eq__', '__format__', '__ge__', '__getattribute__', '__gt__', '__hash__', '__init__', '__init_subclass__', '__le__', '__lt__', '__module__', '__name__', '__ne__', '__new__', '__qualname__', '__reduce__', '__reduce_ex__', '__repr__', '__self__', '__setattr__', '__sizeof__', '__str__', '__subclasshook__', '__text_signature__']25# for '__doc__': 26# ['__add__', '__class__', '__contains__', '__delattr__', '__dir__', '__doc__', '__eq__', '__format__', '__ge__', '__getattribute__', '__getitem__', '__getnewargs__', '__gt__', '__hash__', '__init__', '__init_subclass__', '__iter__', '__le__', '__len__', '__lt__', '__mod__', '__mul__', '__ne__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__rmod__', '__rmul__', '__setattr__', '__sizeof__', '__str__', '__subclasshook__', 'capitalize', 'casefold', 'center', 'count', 'encode', 'endswith', 'expandtabs', 'find', 'format', 'format_map', 'index', 'isalnum', 'isalpha', 'isascii', 'isdecimal', 'isdigit', 'isidentifier', 'islower', 'isnumeric', 'isprintable', 'isspace', 'istitle', 'isupper', 'join', 'ljust', 'lower', 'lstrip', 'maketrans', 'partition', 'removeprefix', 'removesuffix', 'replace', 'rfind', 'rindex', 'rjust', 'rpartition', 'rsplit', 'rstrip', 'split', 'splitlines', 'startswith', 'strip', 'swapcase', 'title', 'translate', 'upper', 'zfill']27# for '__eq__': 28# ['__call__', '__class__', '__delattr__', '__dir__', '__doc__', '__eq__', '__format__', '__ge__', '__getattribute__', '__gt__', '__hash__', '__init__', '__init_subclass__', '__le__', '__lt__', '__name__', '__ne__', '__new__', '__objclass__', '__qualname__', '__reduce__', '__reduce_ex__', '__repr__', '__self__', '__setattr__', '__sizeof__', '__str__', '__subclasshook__', '__text_signature__']29# for '__format__': 30# ['__call__', '__class__', '__delattr__', '__dir__', '__doc__', '__eq__', '__format__', '__ge__', '__getattribute__', '__gt__', '__hash__', '__init__', '__init_subclass__', '__le__', '__lt__', '__module__', '__name__', '__ne__', '__new__', '__qualname__', '__reduce__', '__reduce_ex__', '__repr__', '__self__', '__setattr__', '__sizeof__', '__str__', '__subclasshook__', '__text_signature__']31# for '__ge__': 32# ['__call__', '__class__', '__delattr__', '__dir__', '__doc__', '__eq__', '__format__', '__ge__', '__getattribute__', '__gt__', '__hash__', '__init__', '__init_subclass__', '__le__', '__lt__', '__name__', '__ne__', '__new__', '__objclass__', '__qualname__', '__reduce__', '__reduce_ex__', '__repr__', '__self__', '__setattr__', '__sizeof__', '__str__', '__subclasshook__', '__text_signature__']33# for '__getattribute__': 34# ['__call__', '__class__', '__delattr__', '__dir__', '__doc__', '__eq__', '__format__', '__ge__', '__getattribute__', '__gt__', '__hash__', '__init__', '__init_subclass__', '__le__', '__lt__', '__name__', '__ne__', '__new__', '__objclass__', '__qualname__', '__reduce__', '__reduce_ex__', '__repr__', '__self__', '__setattr__', '__sizeof__', '__str__', '__subclasshook__', '__text_signature__']35# for '__getitem__': 36# ['__call__', '__class__', '__delattr__', '__dir__', '__doc__', '__eq__', '__format__', '__ge__', '__getattribute__', '__gt__', '__hash__', '__init__', '__init_subclass__', '__le__', '__lt__', '__name__', '__ne__', '__new__', '__objclass__', '__qualname__', '__reduce__', '__reduce_ex__', '__repr__', '__self__', '__setattr__', '__sizeof__', '__str__', '__subclasshook__', '__text_signature__']37# for '__getnewargs__': 38# ['__call__', '__class__', '__delattr__', '__dir__', '__doc__', '__eq__', '__format__', '__ge__', '__getattribute__', '__gt__', '__hash__', '__init__', '__init_subclass__', '__le__', '__lt__', '__module__', '__name__', '__ne__', '__new__', '__qualname__', '__reduce__', '__reduce_ex__', '__repr__', '__self__', '__setattr__', '__sizeof__', '__str__', '__subclasshook__', '__text_signature__']39# for '__gt__': 40# ['__call__', '__class__', '__delattr__', '__dir__', '__doc__', '__eq__', '__format__', '__ge__', '__getattribute__', '__gt__', '__hash__', '__init__', '__init_subclass__', '__le__', '__lt__', '__name__', '__ne__', '__new__', '__objclass__', '__qualname__', '__reduce__', '__reduce_ex__', '__repr__', '__self__', '__setattr__', '__sizeof__', '__str__', '__subclasshook__', '__text_signature__']41# for '__hash__': 42# ['__call__', '__class__', '__delattr__', '__dir__', '__doc__', '__eq__', '__format__', '__ge__', '__getattribute__', '__gt__', '__hash__', '__init__', '__init_subclass__', '__le__', '__lt__', '__name__', '__ne__', '__new__', '__objclass__', '__qualname__', '__reduce__', '__reduce_ex__', '__repr__', '__self__', '__setattr__', '__sizeof__', '__str__', '__subclasshook__', '__text_signature__']43# for '__init__': 44# ['__call__', '__class__', '__delattr__', '__dir__', '__doc__', '__eq__', '__format__', '__ge__', '__getattribute__', '__gt__', '__hash__', '__init__', '__init_subclass__', '__le__', '__lt__', '__name__', '__ne__', '__new__', '__objclass__', '__qualname__', '__reduce__', '__reduce_ex__', '__repr__', '__self__', '__setattr__', '__sizeof__', '__str__', '__subclasshook__', '__text_signature__']45# for '__init_subclass__': 46# ['__call__', '__class__', '__delattr__', '__dir__', '__doc__', '__eq__', '__format__', '__ge__', '__getattribute__', '__gt__', '__hash__', '__init__', '__init_subclass__', '__le__', '__lt__', '__module__', '__name__', '__ne__', '__new__', '__qualname__', '__reduce__', '__reduce_ex__', '__repr__', '__self__', '__setattr__', '__sizeof__', '__str__', '__subclasshook__', '__text_signature__']47# for '__iter__': 48# ['__call__', '__class__', '__delattr__', '__dir__', '__doc__', '__eq__', '__format__', '__ge__', '__getattribute__', '__gt__', '__hash__', '__init__', '__init_subclass__', '__le__', '__lt__', '__name__', '__ne__', '__new__', '__objclass__', '__qualname__', '__reduce__', '__reduce_ex__', '__repr__', '__self__', '__setattr__', '__sizeof__', '__str__', '__subclasshook__', '__text_signature__']49# for '__le__': 50# ['__call__', '__class__', '__delattr__', '__dir__', '__doc__', '__eq__', '__format__', '__ge__', '__getattribute__', '__gt__', '__hash__', '__init__', '__init_subclass__', '__le__', '__lt__', '__name__', '__ne__', '__new__', '__objclass__', '__qualname__', '__reduce__', '__reduce_ex__', '__repr__', '__self__', '__setattr__', '__sizeof__', '__str__', '__subclasshook__', '__text_signature__']51# for '__len__': 52# ['__call__', '__class__', '__delattr__', '__dir__', '__doc__', '__eq__', '__format__', '__ge__', '__getattribute__', '__gt__', '__hash__', '__init__', '__init_subclass__', '__le__', '__lt__', '__name__', '__ne__', '__new__', '__objclass__', '__qualname__', '__reduce__', '__reduce_ex__', '__repr__', '__self__', '__setattr__', '__sizeof__', '__str__', '__subclasshook__', '__text_signature__']53# for '__lt__': 54# ['__call__', '__class__', '__delattr__', '__dir__', '__doc__', '__eq__', '__format__', '__ge__', '__getattribute__', '__gt__', '__hash__', '__init__', '__init_subclass__', '__le__', '__lt__', '__name__', '__ne__', '__new__', '__objclass__', '__qualname__', '__reduce__', '__reduce_ex__', '__repr__', '__self__', '__setattr__', '__sizeof__', '__str__', '__subclasshook__', '__text_signature__']55# for '__mul__': 56# ['__call__', '__class__', '__delattr__', '__dir__', '__doc__', '__eq__', '__format__', '__ge__', '__getattribute__', '__gt__', '__hash__', '__init__', '__init_subclass__', '__le__', '__lt__', '__name__', '__ne__', '__new__', '__objclass__', '__qualname__', '__reduce__', '__reduce_ex__', '__repr__', '__self__', '__setattr__', '__sizeof__', '__str__', '__subclasshook__', '__text_signature__']57# for '__ne__': 58# ['__call__', '__class__', '__delattr__', '__dir__', '__doc__', '__eq__', '__format__', '__ge__', '__getattribute__', '__gt__', '__hash__', '__init__', '__init_subclass__', '__le__', '__lt__', '__name__', '__ne__', '__new__', '__objclass__', '__qualname__', '__reduce__', '__reduce_ex__', '__repr__', '__self__', '__setattr__', '__sizeof__', '__str__', '__subclasshook__', '__text_signature__']59# for '__new__': 60# ['__call__', '__class__', '__delattr__', '__dir__', '__doc__', '__eq__', '__format__', '__ge__', '__getattribute__', '__gt__', '__hash__', '__init__', '__init_subclass__', '__le__', '__lt__', '__module__', '__name__', '__ne__', '__new__', '__qualname__', '__reduce__', '__reduce_ex__', '__repr__', '__self__', '__setattr__', '__sizeof__', '__str__', '__subclasshook__', '__text_signature__']61# for '__reduce__': 62# ['__call__', '__class__', '__delattr__', '__dir__', '__doc__', '__eq__', '__format__', '__ge__', '__getattribute__', '__gt__', '__hash__', '__init__', '__init_subclass__', '__le__', '__lt__', '__module__', '__name__', '__ne__', '__new__', '__qualname__', '__reduce__', '__reduce_ex__', '__repr__', '__self__', '__setattr__', '__sizeof__', '__str__', '__subclasshook__', '__text_signature__']63# for '__reduce_ex__': 64# ['__call__', '__class__', '__delattr__', '__dir__', '__doc__', '__eq__', '__format__', '__ge__', '__getattribute__', '__gt__', '__hash__', '__init__', '__init_subclass__', '__le__', '__lt__', '__module__', '__name__', '__ne__', '__new__', '__qualname__', '__reduce__', '__reduce_ex__', '__repr__', '__self__', '__setattr__', '__sizeof__', '__str__', '__subclasshook__', '__text_signature__']65# for '__repr__': 66# ['__call__', '__class__', '__delattr__', '__dir__', '__doc__', '__eq__', '__format__', '__ge__', '__getattribute__', '__gt__', '__hash__', '__init__', '__init_subclass__', '__le__', '__lt__', '__name__', '__ne__', '__new__', '__objclass__', '__qualname__', '__reduce__', '__reduce_ex__', '__repr__', '__self__', '__setattr__', '__sizeof__', '__str__', '__subclasshook__', '__text_signature__']67# for '__rmul__': 68# ['__call__', '__class__', '__delattr__', '__dir__', '__doc__', '__eq__', '__format__', '__ge__', '__getattribute__', '__gt__', '__hash__', '__init__', '__init_subclass__', '__le__', '__lt__', '__name__', '__ne__', '__new__', '__objclass__', '__qualname__', '__reduce__', '__reduce_ex__', '__repr__', '__self__', '__setattr__', '__sizeof__', '__str__', '__subclasshook__', '__text_signature__']69# for '__setattr__': 70# ['__call__', '__class__', '__delattr__', '__dir__', '__doc__', '__eq__', '__format__', '__ge__', '__getattribute__', '__gt__', '__hash__', '__init__', '__init_subclass__', '__le__', '__lt__', '__name__', '__ne__', '__new__', '__objclass__', '__qualname__', '__reduce__', '__reduce_ex__', '__repr__', '__self__', '__setattr__', '__sizeof__', '__str__', '__subclasshook__', '__text_signature__']71# for '__sizeof__': 72# ['__call__', '__class__', '__delattr__', '__dir__', '__doc__', '__eq__', '__format__', '__ge__', '__getattribute__', '__gt__', '__hash__', '__init__', '__init_subclass__', '__le__', '__lt__', '__module__', '__name__', '__ne__', '__new__', '__qualname__', '__reduce__', '__reduce_ex__', '__repr__', '__self__', '__setattr__', '__sizeof__', '__str__', '__subclasshook__', '__text_signature__']73# for '__str__': 74# ['__call__', '__class__', '__delattr__', '__dir__', '__doc__', '__eq__', '__format__', '__ge__', '__getattribute__', '__gt__', '__hash__', '__init__', '__init_subclass__', '__le__', '__lt__', '__name__', '__ne__', '__new__', '__objclass__', '__qualname__', '__reduce__', '__reduce_ex__', '__repr__', '__self__', '__setattr__', '__sizeof__', '__str__', '__subclasshook__', '__text_signature__']75# for '__subclasshook__': 76# ['__call__', '__class__', '__delattr__', '__dir__', '__doc__', '__eq__', '__format__', '__ge__', '__getattribute__', '__gt__', '__hash__', '__init__', '__init_subclass__', '__le__', '__lt__', '__module__', '__name__', '__ne__', '__new__', '__qualname__', '__reduce__', '__reduce_ex__', '__repr__', '__self__', '__setattr__', '__sizeof__', '__str__', '__subclasshook__', '__text_signature__']77# for 'count': 78# ['__call__', '__class__', '__delattr__', '__dir__', '__doc__', '__eq__', '__format__', '__ge__', '__getattribute__', '__gt__', '__hash__', '__init__', '__init_subclass__', '__le__', '__lt__', '__module__', '__name__', '__ne__', '__new__', '__qualname__', '__reduce__', '__reduce_ex__', '__repr__', '__self__', '__setattr__', '__sizeof__', '__str__', '__subclasshook__', '__text_signature__']79# for 'index': ...

Full Screen

Full Screen

test_place_model.py

Source:test_place_model.py Github

copy

Full Screen

...49 def test_Place_attributes(self):50 '''51 Checks that the attribute exist.52 '''53 self.assertTrue("city_id" in self.new_place.__dir__())54 self.assertTrue("user_id" in self.new_place.__dir__())55 self.assertTrue("description" in self.new_place.__dir__())56 self.assertTrue("name" in self.new_place.__dir__())57 self.assertTrue("number_rooms" in self.new_place.__dir__())58 self.assertTrue("max_guest" in self.new_place.__dir__())59 self.assertTrue("price_by_night" in self.new_place.__dir__())60 self.assertTrue("latitude" in self.new_place.__dir__())61 self.assertTrue("longitude" in self.new_place.__dir__())62 @unittest.skipIf(storage == "db", "Testing database storage only")63 def test_place_amenity_attrb(self):64 self.assertTrue("amenity_ids" in self.new_place.__dir__())65 @unittest.skipIf(storage != "db", "Testing database storage only")66 def test_place_amenity_dbattrb(self):67 self.assertTrue("amenities" in self.new_place.__dir__())68 self.assertTrue("reviews" in self.new_place.__dir__())69 @unittest.skipIf(storage == "db", "Testing database storage only")70 def test_type_longitude(self):71 '''72 Test the type of longitude.73 '''74 longitude = getattr(self.new_place, "longitude")75 self.assertIsInstance(longitude, float)76 @unittest.skipIf(storage == "db", "Testing database storage only")77 def test_type_latitude(self):78 '''79 Test the type of latitude80 '''81 latitude = getattr(self.new_place, "latitude")82 self.assertIsInstance(latitude, float)...

Full Screen

Full Screen

test_Grinder.py

Source:test_Grinder.py Github

copy

Full Screen

...7from tests import BZTestCase, __dir__8from tests.mocks import EngineEmul9class TestGrinderExecutor(BZTestCase):10 def test_install_Grinder(self):11 path = os.path.abspath(__dir__() + "/../../build/tmp/grinder-taurus/lib/grinder.jar")12 shutil.rmtree(os.path.dirname(os.path.dirname(path)), ignore_errors=True)13 grinder_link = GrinderExecutor.DOWNLOAD_LINK14 grinder_version = GrinderExecutor.VERSION15 mirrors_source = GrinderExecutor.MIRRORS_SOURCE16 GrinderExecutor.DOWNLOAD_LINK = "file:///" + __dir__() + "/../data/grinder-{version}_{version}-binary.zip"17 GrinderExecutor.VERSION = "3.11"18 GrinderExecutor.MIRRORS_SOURCE = "file:///" + __dir__() + "/../data/unicode_file"19 self.assertFalse(os.path.exists(path))20 obj = GrinderExecutor()21 obj.engine = EngineEmul()22 obj.settings.merge({"path": path})23 obj.settings.merge({"properties-file": __dir__() + "/../grinder/grinder.base.properties",24 "properties": {"sample_prop": "some_val"}})25 obj.execution.merge({"scenario": {26 "script": __dir__() + "/../grinder/helloworld.py",27 "properties-file": __dir__() + "/..//grinder/grinder.properties",28 "properties": {"grinder.useConsole": "false"}}})29 obj.prepare()30 self.assertTrue(os.path.exists(path))31 GrinderExecutor.DOWNLOAD_LINK = grinder_link32 GrinderExecutor.VERSION = grinder_version33 GrinderExecutor.MIRRORS_SOURCE = mirrors_source34 def test_grinder_widget(self):35 obj = GrinderExecutor()36 obj.engine = EngineEmul()37 obj.settings.merge({'path': __dir__() + "/../grinder/fake_grinder.jar"})38 obj.engine.config.merge({"provisioning": 'local'})39 obj.execution.merge({"concurrency": {"local": 2},40 "ramp-up": 2,41 "hold-for": 2,42 "scenario": {"script": __dir__() + "/../grinder/helloworld.py"}})43 obj.prepare()44 obj.get_widget()45 self.assertEqual(obj.widget.widgets[0].text, "Script: helloworld.py")46 def test_resource_files_collection_basic(self):47 obj = GrinderExecutor()48 obj.engine = EngineEmul()49 obj.execution.merge({"scenario": {"script": __dir__() + "/../grinder/helloworld.py"}})50 res_files = obj.resource_files()51 self.assertEqual(len(res_files), 1)52 def test_fail_on_zero_results(self):53 obj = GrinderExecutor()54 obj.engine = EngineEmul()55 obj.settings.merge({'path': __dir__() + "/../grinder/fake_grinder.jar"})56 obj.execution.merge({"concurrency": {"local": 2},57 "scenario": {"script": __dir__() + "/../grinder/helloworld.py"}})58 obj.prepare()59 self.assertRaises(RuntimeWarning, obj.post_process)60 def test_requests(self):61 obj = GrinderExecutor()62 obj.engine = EngineEmul()63 obj.settings.merge({'path': __dir__() + "/../grinder/fake_grinder.jar"})64 obj.execution.merge({"scenario": {"requests": ['http://blazedemo.com']}})65 obj.prepare()66 def test_full_Grinder(self):67 obj = GrinderExecutor()68 obj.kpi_file = os.path.abspath(__dir__() + '/../grinder/test.log')69 obj.engine = EngineEmul()70 obj.settings.merge({'path': __dir__() + "/../grinder/fake_grinder.jar"})71 obj.execution.merge({"concurrency": {"local": 2},72 "hold-for": 5,73 "scenario": {"requests": ['http://blazedemo.com']}})74 obj.prepare()75 self.assertEqual(len(obj.cmd_line), 5)76 cmd_line = ' '.join(obj.cmd_line)77 self.assertTrue(cmd_line.startswith('java -classpath'))78 self.assertNotEqual(cmd_line.find('net.grinder.Grinder'), -1)79 try:80 obj.cmd_line = __dir__() + "/../grinder/grinder" + EXE_SUFFIX81 obj.startup()82 while not obj.check():83 time.sleep(obj.engine.check_interval)84 finally:85 obj.shutdown()86 self.assertRaises(RuntimeWarning, obj.post_process)87class TestDataLogReader(BZTestCase):88 def test_read(self):89 log_path = os.path.join(os.path.dirname(__file__), '..', 'grinder', 'grinder-bzt-kpi.log')90 obj = DataLogReader(log_path, logging.getLogger(''))91 list_of_values = list(obj.datapoints(True))...

Full Screen

Full Screen

test_file_locator.py

Source:test_file_locator.py Github

copy

Full Screen

1# -*- coding: utf-8 -*-2# This file is part of the pymfony package.3#4# (c) Alexandre Quercia <alquerci@email.com>5#6# For the full copyright and license information, please view the LICENSE7# file that was distributed with this source code.8from __future__ import absolute_import;9import unittest;10import os;11from pymfony.component.config import FileLocator;12from pymfony.component.system.exception import InvalidArgumentException13"""14"""15__DIR__ = os.path.dirname(os.path.realpath(__file__));16class FileLocatorTest(unittest.TestCase):17 def testIsAbsolutePath(self):18 """19 @dataProvider getIsAbsolutePathTests20 """21 def test(path):22 loader = FileLocator([]);23 self.assertTrue(getattr(loader, '_FileLocator__isAbsolutePath')(path), '->isAbsolutePath() returns True for an absolute path');24 for data in self.getIsAbsolutePathTests():25 test(*data);26 def getIsAbsolutePathTests(self):27 return [28 ['/foo.xml'],29 ['c:\\\\foo.xml'],30 ['c:/foo.xml'],31 ['\\server\\foo.xml'],32 ['https://server/foo.xml'],33 ['phar://server/foo.xml'],34 ];35 def testLocate(self):36 loader = FileLocator(__DIR__+'/Fixtures');37 self.assertEqual(38 __DIR__+os.path.sep+'test_file_locator.py',39 loader.locate('test_file_locator.py', __DIR__),40 '->locate() returns the absolute filename if the file exists in the given path'41 );42 self.assertEqual(43 __DIR__+'/Fixtures'+os.path.sep+'foo.xml',44 loader.locate('foo.xml', __DIR__),45 '->locate() returns the absolute filename if the file exists in one of the paths given in the constructor'46 );47 self.assertEqual(48 __DIR__+'/Fixtures'+os.path.sep+'foo.xml',49 loader.locate(__DIR__+'/Fixtures'+os.path.sep+'foo.xml', __DIR__),50 '->locate() returns the absolute filename if the file exists in one of the paths given in the constructor'51 );52 loader = FileLocator([__DIR__+'/Fixtures', __DIR__+'/Fixtures/Again']);53 self.assertEqual(54 [__DIR__+'/Fixtures'+os.path.sep+'foo.xml', __DIR__+'/Fixtures/Again'+os.path.sep+'foo.xml'],55 loader.locate('foo.xml', __DIR__, False),56 '->locate() returns an array of absolute filenames'57 );58 self.assertEqual(59 [__DIR__+'/Fixtures'+os.path.sep+'foo.xml', __DIR__+'/Fixtures/Again'+os.path.sep+'foo.xml'],60 loader.locate('foo.xml', __DIR__+'/Fixtures', False),61 '->locate() returns an array of absolute filenames'62 );63 loader = FileLocator(__DIR__+'/Fixtures/Again');64 self.assertEqual(65 [__DIR__+'/Fixtures'+os.path.sep+'foo.xml', __DIR__+'/Fixtures/Again'+os.path.sep+'foo.xml'],66 loader.locate('foo.xml', __DIR__+'/Fixtures', False),67 '->locate() returns an array of absolute filenames'68 );69 def testLocateThrowsAnExceptionIfTheFileDoesNotExists(self):70 """@expectedException InvalidArgumentException71 """72 try:73 loader = FileLocator([__DIR__+'/Fixtures']);74 loader.locate('foobar.xml', __DIR__);75 self.fail()76 except Exception as e:77 self.assertTrue(isinstance(e, InvalidArgumentException));78 def testLocateThrowsAnExceptionIfTheFileDoesNotExistsInAbsolutePath(self):79 """@expectedException InvalidArgumentException80 """81 try:82 loader = FileLocator([__DIR__+'/Fixtures']);83 loader.locate(__DIR__+'/Fixtures/foobar.xml', __DIR__);84 self.fail()85 except Exception as e:86 self.assertTrue(isinstance(e, InvalidArgumentException));87if __name__ == '__main__':...

Full Screen

Full Screen

Automation Testing Tutorials

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.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run autotest automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful