# Path: src/singleton/singleton_metaclass.py
# class Driver(metaclass=MetaClassSingleton):
#     """
#     Driver class decorated by the meta class: MetaClassSingleton.
#     Behaviour changed in singleton
#     """
#     connection = None
# 
#     def connect(self):
#         """
#         Set the connection with the web driver
#         :return: web driver
#         """
#         if self.connection is None:
#             self.connection = webdriver.Chrome()
# 
#         return self.connection


from unittest import TestCase
from src.singleton.singleton_metaclass import Driver
"""
Description:
    - Check the object instance memory location

@author: Paul Bodean
@date: 26/12/2017
"""



class TestMetaSingleton(TestCase):
    def test_singleton(self):
        dr1 = Driver().connect()

# Path: src/singleton/singleton_metaclass.py
# class Driver(metaclass=MetaClassSingleton):
#     """
#     Driver class decorated by the meta class: MetaClassSingleton.
#     Behaviour changed in singleton
#     """
#     connection = None
# 
#     def connect(self):
#         """
#         Set the connection with the web driver
#         :return: web driver
#         """
#         if self.connection is None:
#             self.connection = webdriver.Chrome()
# 
#         return self.connection


# Path: tests/singleton/test_meta_singleton.py
from unittest import TestCase
from src.singleton.singleton_metaclass import Driver

"""
Description:
    - Check the object instance memory location

@author: Paul Bodean
@date: 26/12/2017
"""



class TestMetaSingleton(TestCase):
    def test_singleton(self):
        dr1 = Driver().connect()

        dr2 = Driver().connect()