@@ -1321,6 +1321,50 @@ def test_max_rows_fitted(self, length, min_rows, max_rows, expected):
1321
1321
result = formatter .max_rows_fitted
1322
1322
assert result == expected
1323
1323
1324
+ def test_display_settings_with_emojis (self ):
1325
+ # Define the data for DataFrame
1326
+ example = {
1327
+ "normal_col" : [1 , 2 , 3 ],
1328
+ "text_col" : ["hello world" ] * 3 ,
1329
+ "emoji_col_A" : ["🟩 hello world" ] * 3 ,
1330
+ "emoji_col_B" : ["🟥 hello world" ] * 3 ,
1331
+ }
1332
+ # Create DataFrame
1333
+ df = DataFrame (example )
1334
+ output = repr (df )
1335
+ expected_output = """ normal_col text_col emoji_col_A emoji_col_B
1336
+ 0 1 hello world 🟩 hello world 🟥 hello world
1337
+ 1 2 hello world 🟩 hello world 🟥 hello world
1338
+ 2 3 hello world 🟩 hello world 🟥 hello world"""
1339
+
1340
+ assert output == expected_output
1341
+
1342
+ # Reset options to defaults
1343
+ reset_option ("display.max_rows" )
1344
+ reset_option ("display.max_columns" )
1345
+ reset_option ("display.width" )
1346
+
1347
+ example2 = {
1348
+ "normal_col" : [1 , 2 , 3 ],
1349
+ "text_col" : ["hello world" ] * 3 ,
1350
+ "emoji_col_A" : ["🙏🙏 hello world" ] * 3 ,
1351
+ }
1352
+ # Create DataFrame
1353
+ df = DataFrame (example2 )
1354
+ output = repr (df )
1355
+ expected_output2 = """ normal_col text_col emoji_col_A
1356
+ 0 1 hello world 🙏🙏 hello world
1357
+ 1 2 hello world 🙏🙏 hello world
1358
+ 2 3 hello world 🙏🙏 hello world"""
1359
+ # Check if the actual output matches expected output
1360
+ assert output == expected_output2
1361
+
1362
+ # Reset options to defaults
1363
+ reset_option ("display.max_rows" )
1364
+ reset_option ("display.max_columns" )
1365
+ reset_option ("display.width" )
1366
+ reset_option ("display.unicode.east_asian_width" )
1367
+
1324
1368
1325
1369
def gen_series_formatting ():
1326
1370
s1 = Series (["a" ] * 100 )
0 commit comments