7
7
8
8
9
9
@pytest .fixture (scope = "function" )
10
- def enable_hidden_attributes ():
11
- orig_config_val = config .get ("enable_hidden_attributes " )
12
- config ["enable_hidden_attributes " ] = True
10
+ def enable_add_hidden_timestamp ():
11
+ orig_config_val = config .get ("add_hidden_timestamp " )
12
+ config ["add_hidden_timestamp " ] = True
13
13
yield
14
14
if orig_config_val is not None :
15
- config ["enable_hidden_attributes " ] = orig_config_val
15
+ config ["add_hidden_timestamp " ] = orig_config_val
16
16
17
17
18
18
@pytest .fixture (scope = "function" )
19
- def disable_hidden_attributes ():
20
- orig_config_val = config .get ("enable_hidden_attributes " )
21
- config ["enable_hidden_attributes " ] = False
19
+ def disable_add_hidden_timestamp ():
20
+ orig_config_val = config .get ("add_hidden_timestamp " )
21
+ config ["add_hidden_timestamp " ] = False
22
22
yield
23
23
if orig_config_val is not None :
24
- config ["enable_hidden_attributes " ] = orig_config_val
24
+ config ["add_hidden_timestamp " ] = orig_config_val
25
25
26
26
27
27
def test_schema_decorator (schema_any ):
@@ -392,17 +392,15 @@ class Table_With_Underscores(dj.Manual):
392
392
schema_any (Table_With_Underscores )
393
393
394
394
395
- def test_hidden_attributes_default_value ():
396
- config_val = config .get ("enable_hidden_attributes " )
395
+ def test_add_hidden_timestamp_default_value ():
396
+ config_val = config .get ("add_hidden_timestamp " )
397
397
assert (
398
398
config_val is not None and not config_val
399
- ), "Default value for enable_hidden_attributes is not False"
399
+ ), "Default value for add_hidden_timestamp is not False"
400
400
401
401
402
- def test_hidden_attributes_enabled (enable_hidden_attributes , schema_any ):
403
- orig_config_val = config .get ("enable_hidden_attributes" )
404
- config ["enable_hidden_attributes" ] = True
405
-
402
+ def test_add_hidden_timestamp_enabled (enable_add_hidden_timestamp , schema_any ):
403
+ assert config ["add_hidden_timestamp" ], "add_hidden_timestamp is not enabled"
406
404
msg = f"{ Experiment ().heading ._attributes = } "
407
405
assert any (
408
406
a .name .endswith ("_timestamp" ) for a in Experiment ().heading ._attributes .values ()
@@ -413,14 +411,9 @@ def test_hidden_attributes_enabled(enable_hidden_attributes, schema_any):
413
411
assert any (a .is_hidden for a in Experiment ().heading ._attributes .values ()), msg
414
412
assert not any (a .is_hidden for a in Experiment ().heading .attributes .values ()), msg
415
413
416
- if orig_config_val is not None :
417
- config ["enable_hidden_attributes" ] = orig_config_val
418
-
419
-
420
- def test_hidden_attributes_disabled (disable_hidden_attributes , schema_any ):
421
- orig_config_val = config .get ("enable_hidden_attributes" )
422
- config ["enable_hidden_attributes" ] = False
423
414
415
+ def test_add_hidden_timestamp_disabled (disable_add_hidden_timestamp , schema_any ):
416
+ assert not config ["add_hidden_timestamp" ], "expected add_hidden_timestamp to be False"
424
417
msg = f"{ Experiment ().heading ._attributes = } "
425
418
assert not any (
426
419
a .name .endswith ("_timestamp" ) for a in Experiment ().heading ._attributes .values ()
@@ -430,6 +423,3 @@ def test_hidden_attributes_disabled(disable_hidden_attributes, schema_any):
430
423
), msg
431
424
assert not any (a .is_hidden for a in Experiment ().heading ._attributes .values ()), msg
432
425
assert not any (a .is_hidden for a in Experiment ().heading .attributes .values ()), msg
433
-
434
- if orig_config_val is not None :
435
- config ["enable_hidden_attributes" ] = orig_config_val
0 commit comments