You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
This repo is archived. You can view files and clone it, but cannot push or open issues/pull-requests.
 
 
 
 
 
 

32 lines
968 B

  1. import lister
  2. def test_parse_args_empty_list():
  3. options = lister.parse_args([])
  4. assert options.show_modification_time is False
  5. def test_parse_args_dash_l():
  6. options = lister.parse_args(["-l"])
  7. assert options.show_modification_time is True
  8. def test_list_empty_entries():
  9. options = lister.Options()
  10. assert list(lister.list_entries([], options)) == []
  11. def get_listing(entries, show_modification_time=False):
  12. options = lister.Options()
  13. options.show_modification_time = show_modification_time
  14. return list(lister.list_entries(entries, options))
  15. def test_list_names():
  16. foo_txt = lister.Entry("foo.txt")
  17. entries = [foo_txt]
  18. assert get_listing(entries, show_modification_time=False) == ["foo.txt"]
  19. def test_list_mtimes():
  20. foo_txt = lister.Entry("foo.txt")
  21. foo_txt.mtime = 1559404640
  22. entries = [foo_txt]
  23. assert get_listing(entries, show_modification_time=True)== ["foo.txt 1559404640"]