@@ -96,6 +96,42 @@ def test_LicenseSymbol(self):
9696 # symbol euqality is based ONLY on the key
9797 assert sym5 == sym6
9898
99+ def test_python_operators_simple (self ):
100+ licensing = Licensing ()
101+
102+ sym1 = LicenseSymbol ('MIT' )
103+ sym2 = LicenseSymbol ('BSD-2' )
104+
105+ assert sym1 & sym2 == licensing .AND (sym1 , sym2 )
106+ assert sym1 | sym2 == licensing .OR (sym1 , sym2 )
107+
108+ sym3 = LicenseWithExceptionSymbol (LicenseSymbol ("GPL-3.0-or-later" ), LicenseSymbol ("GCC-exception-3.1" ))
109+
110+ # Make sure LicenseWithExceptionSymbol operation work on left and right side
111+ assert sym3 & sym1 == licensing .AND (sym3 , sym1 )
112+ assert sym1 & sym3 == licensing .AND (sym1 , sym3 )
113+ assert sym3 | sym1 == licensing .OR (sym3 , sym1 )
114+ assert sym1 | sym3 == licensing .OR (sym3 , sym1 )
115+
116+ def test_boolean_expression_operators (self ):
117+
118+ # Make sure LicenseWithExceptionSymbol boolean expression are set
119+ assert LicenseWithExceptionSymbol .Symbol is not None
120+ assert LicenseWithExceptionSymbol .TRUE is not None
121+ assert LicenseWithExceptionSymbol .FALSE is not None
122+ assert LicenseWithExceptionSymbol .AND is not None
123+ assert LicenseWithExceptionSymbol .OR is not None
124+ assert LicenseWithExceptionSymbol .NOT is not None
125+
126+ # Make sure LicenseWithExceptionSymbol matches LicenseSymbol
127+ assert LicenseWithExceptionSymbol .Symbol == LicenseSymbol
128+ assert LicenseWithExceptionSymbol .TRUE == LicenseSymbol .TRUE
129+ assert LicenseWithExceptionSymbol .FALSE == LicenseSymbol .FALSE
130+ assert LicenseWithExceptionSymbol .AND == LicenseSymbol .AND
131+ assert LicenseWithExceptionSymbol .OR == LicenseSymbol .OR
132+ assert LicenseWithExceptionSymbol .NOT == LicenseSymbol .NOT
133+
134+
99135
100136class LicensingTest (TestCase ):
101137
0 commit comments