code: def test_ActivityStats_basic():
      stats = ActivityStats()
      assert_raises(
          AttributeError, setattr, stats, "unknown_attribute", 1
      )
  
      for c in _COUNTS:
          assert_equal(getattr(stats, c), 0)
  
      stats.files += 1
      assert_equal(stats.files, 1)
      stats.increment("files")
      assert_equal(stats.files, 2)
  
      assert_equal(stats.as_dict()["files"], 2)
      # smoke tests
      assert_equal(stats.as_str(), stats.as_str(mode="full"))
      assert_equal(len(stats.as_str(mode="line").split("\n")), 1)
  
      assert_in("files=2", repr(stats))
      stats.reset()
      for c in _COUNTS:
          assert_equal(getattr(stats, c), 0)
  
      # Check a copy of stats
      stats_total = stats.get_total()
      assert_equal(stats_total.files, 2)
      stats.files += 1
      assert_equal(stats.files, 1)
      assert_equal(stats_total.files, 2)  # shouldn't change -- a copy!
  
      # Let's add some merges
      stats.merges.append(("upstream", "master"))
      stats_total = stats.get_total()
      assert_equal(stats_total.merges, stats.merges)
  
      assert_equal(
          stats.as_str(),
          """Files processed: 1
  Branches merged: upstream->master""",
      )
      assert_equal(
          stats.as_str(mode="line"),
          "Files processed: 1,  Branches merged: upstream->master",
      )
  
      stats.urls += 2
      stats.downloaded += 1
      stats.downloaded_size += 123456789  # will invoke formatter
      assert_in("size: 123.5 MB", stats.as_str())
  
imports: from ...tests.utils_pytest import assert_equal, assert_in, assert_not_equal, assert_raises
  from ..stats import _COUNTS, ActivityStats
label_desc: Use image node_id 1 for calling a global function with example usage: test_ActivityStats_basic() without return types