@@ -155,7 +155,7 @@ def test_scope_data_direct_instantiation_with_namespaced_key(self):
155155 """Test that ScopeData can be instantiated with namespaced_key.
156156
157157 Expected Result:
158- - ScopeData(namespaced_key='sc ^generic') creates ScopeData instance
158+ - ScopeData(namespaced_key='global ^generic') creates ScopeData instance
159159 """
160160 namespaced_key = f"{ ScopeData .NAMESPACE } { ScopeData .SEPARATOR } generic"
161161
@@ -222,25 +222,25 @@ def test_scope_data_registration(self):
222222 """Test that ScopeData and its subclasses are registered correctly.
223223
224224 Expected Result:
225- - 'sc ' namespace maps to ScopeData class
225+ - 'global ' namespace maps to ScopeData class
226226 - 'lib' namespace maps to ContentLibraryData class
227227 """
228- self .assertIn ("sc " , ScopeData .scope_registry )
229- self .assertIs (ScopeData .scope_registry ["sc " ], ScopeData )
228+ self .assertIn ("global " , ScopeData .scope_registry )
229+ self .assertIs (ScopeData .scope_registry ["global " ], ScopeData )
230230 self .assertIn ("lib" , ScopeData .scope_registry )
231231 self .assertIs (ScopeData .scope_registry ["lib" ], ContentLibraryData )
232232
233233 @data (
234234 ("lib^lib:DemoX:CSPROB" , ContentLibraryData ),
235- ("sc ^generic_scope" , ScopeData ),
235+ ("global ^generic_scope" , ScopeData ),
236236 )
237237 @unpack
238238 def test_dynamic_instantiation_via_namespaced_key (self , namespaced_key , expected_class ):
239239 """Test that ScopeData dynamically instantiates the correct subclass.
240240
241241 Expected Result:
242242 - ScopeData(namespaced_key='lib^...') returns ContentLibraryData instance
243- - ScopeData(namespaced_key='sc ^...') returns ScopeData instance
243+ - ScopeData(namespaced_key='global ^...') returns ScopeData instance
244244 """
245245 instance = ScopeData (namespaced_key = namespaced_key )
246246
@@ -249,7 +249,7 @@ def test_dynamic_instantiation_via_namespaced_key(self, namespaced_key, expected
249249
250250 @data (
251251 ("lib^lib:DemoX:CSPROB" , ContentLibraryData ),
252- ("sc ^generic" , ScopeData ),
252+ ("global ^generic" , ScopeData ),
253253 ("unknown^something" , ScopeData ),
254254 )
255255 @unpack
@@ -258,7 +258,7 @@ def test_get_subclass_by_namespaced_key(self, namespaced_key, expected_class):
258258
259259 Expected Result:
260260 - 'lib^...' returns ContentLibraryData
261- - 'sc ^...' returns ScopeData
261+ - 'global ^...' returns ScopeData
262262 - 'unknown^...' returns ScopeData (fallback)
263263 """
264264 subclass = ScopeMeta .get_subclass_by_namespaced_key (namespaced_key )
@@ -268,15 +268,15 @@ def test_get_subclass_by_namespaced_key(self, namespaced_key, expected_class):
268268 @data (
269269 ("lib:DemoX:CSPROB" , ContentLibraryData ),
270270 ("lib:edX:Demo" , ContentLibraryData ),
271- ("sc :generic_scope" , ScopeData ),
271+ ("global :generic_scope" , ScopeData ),
272272 )
273273 @unpack
274274 def test_get_subclass_by_external_key (self , external_key , expected_class ):
275275 """Test get_subclass_by_external_key returns correct subclass.
276276
277277 Expected Result:
278278 - 'lib:...' returns ContentLibraryData
279- - 'sc :...' returns ScopeData
279+ - 'global :...' returns ScopeData
280280 """
281281 subclass = ScopeMeta .get_subclass_by_external_key (external_key )
282282
@@ -319,12 +319,12 @@ def test_base_scope_data_with_external_key(self):
319319 - ScopeData(external_key='...') creates ScopeData instance
320320 - No dynamic subclass selection occurs
321321 """
322- scope = ScopeData (external_key = "sc :generic_scope" )
322+ scope = ScopeData (external_key = "global :generic_scope" )
323323
324- expected_namespaced = f"{ ScopeData .NAMESPACE } { ScopeData .SEPARATOR } sc :generic_scope"
324+ expected_namespaced = f"{ ScopeData .NAMESPACE } { ScopeData .SEPARATOR } global :generic_scope"
325325
326326 self .assertIsInstance (scope , ScopeData )
327- self .assertEqual (scope .external_key , "sc :generic_scope" )
327+ self .assertEqual (scope .external_key , "global :generic_scope" )
328328 self .assertEqual (scope .namespaced_key , expected_namespaced )
329329
330330 def test_empty_namespaced_key_raises_value_error (self ):
@@ -345,6 +345,27 @@ def test_empty_external_key_raises_value_error(self):
345345 with self .assertRaises (ValueError ):
346346 SubjectData (external_key = "" )
347347
348+ def test_scope_data_with_wildcard_external_key (self ):
349+ """Test that ScopeData instantiated with wildcard (*) returns base ScopeData.
350+
351+ When using the global scope wildcard '*', the metaclass should return a base
352+ ScopeData instance rather than attempting subclass determination.
353+
354+ Expected Result:
355+ - ScopeData(external_key='*') creates base ScopeData instance
356+ - namespaced_key is 'global^*'
357+ - No subclass determination occurs
358+ """
359+ scope = ScopeData (external_key = "*" )
360+
361+ expected_namespaced = f"{ ScopeData .NAMESPACE } { ScopeData .SEPARATOR } *"
362+
363+ self .assertIsInstance (scope , ScopeData )
364+ # Ensure it's exactly ScopeData, not a subclass
365+ self .assertEqual (type (scope ), ScopeData )
366+ self .assertEqual (scope .external_key , "*" )
367+ self .assertEqual (scope .namespaced_key , expected_namespaced )
368+
348369
349370@ddt
350371class TestDataRepresentation (TestCase ):
0 commit comments